This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ProductSkuWarehouseStock.where('available_qty', '>', 0).where.not(warehouse_id: 81).find_in_batches(batch_size: 500) do |stocks| | |
stocks.each do |stock| | |
p_list_inactive = Product.where(sku_id: stock[:product_sku_id], state: 0).pluck(:id) | |
p_list_active = Product.where(sku_id: stock[:product_sku_id], state: 1).pluck(:id) | |
if p_list_active.size == 0 | |
puts "For SKU ID #{stock[:product_sku_id]}, warehouse ID: #{stock[:warehouse_id]} found inactive product ID: #{p_list_inactive}" | |
end | |
if p_list_inactive.size == 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ping process detector. if no running ping process, execute it once | |
# to be called by cron (for checking and re-spawn) every 1 minute | |
# need to specify destination IP for ping first | |
if [[ -z $DEST_IP ]]; then | |
echo "Please set DEST_IP before calling this script" | |
exit 1 | |
fi |