I'm building an interface to basically list computers on my local network that are 'alive' and more or less have a list of these nodes, and their 'status'.
I've created a file called farm_ping.sh
located under /Volumes/raid/farm_scripts/_apps/_scripts/farm_ping.sh
This file contains the following, which simply pings the IP and writes it's result to a txt file also named by the given IP:
HOSTS="192.168.1.110"
# no ping request
COUNT=1
for myHost in $HOSTS
do
count=$(ping -c $COUNT $myHost | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
if [ $count -eq 0 ]; then
# 100% failed
echo "Host : $myHost is down (ping failed) at $(date)" > /Volumes/raid/farm_script/nodes_response/$myHost.txt
else
# 100% Passed
echo "Host : $myHost is running (ping successful) at $(date)" > /Volumes/raid/farm_script/nodes_response/$myHost.txt
fi
done
I want this to run this script every minute, here's what I have done to create a cron job:
env EDITOR=nano crontab -e
And in the cron job I wrote:
1 * * * * /Volumes/raid/farm_script/_apps/_scripts/farm_ping.sh
I saved this file, but it's been 30 mintues, and nothing has written yet, what have I done wrong?