Having an issues with a crontab script on ubuntu server, if any one can help ? so they script runs ok if i execute it from the terminal, but when it's s crontab job it doesn't seem to get very far.
so the entry in crontab is
* * * * * root /bin/bash /home/username/checkping.sh >> /home/username/result.txt
once it has run i loook at result.txt and it shows only the following
ping 192.168.1.200 (192.168.1.200) 56 (84) bytes of data.
from 192.168.1.200 icmp_seq=1 destination host unreachable
from 192.168.1.200 icmp_seq=2 destination host unreachable
from 192.168.1.200 icmp_seq=3 destination host unreachable
--- 192.168.1.200 ping stats ---
3 packets transmitted, 0 recived , +3 errors, 100% packet loss, time 2000ms
pipe 3
the script looks like this.
#!/bin/bash
if ping -c 3 192.168.1.200
then
: # Null for exit
else
/usr/local/bin/lightwaverf "Living Room" "Router" off
sleep 10
/usr/local/bin/lightwaverf "Living Room" "Router" on
fi
It works if i run it, and just exits if 192.168.1.200 pings, and runs the lightwaverf command fine with a sleep if 192.168.1.200 doesn't ping.
I suspect that i need to pipe/catch a variable from the ping command and do a test or something, as it's not running the same way as a terminal would...
Please help !