Hi i have written 1 bash script but it is not working in cron job
the script is for checking the status of internet connection from two diff isp using ping command #!/bin/bash for file in `cat ipaddress` do ipAdd=`echo $file | awk -F, '{print $1}'` curstate=0 pstate=0 case "$ipAdd" in 1.1.1.1) prevstate="./mtnl.txt" echo "IPADDRESS = $prevstate" msg="./isp1_report.txt" ;; 2.2.2.2) prevstate="./netmagic.txt" echo "IPADDRESS = $prevstate" msg="./isp2_report.txt";; esac curstate=`/bin/ping -c 1 $ipAdd | grep "100% packet loss" | wc -l` echo "current state= $curstate" for pstate in `cat $prevstate` do echo "previous state==$pstate" done if [ $curstate -ne $pstate ] ; then echo "status changed" ; if [ $curstate -ne 0 ] ; then echo "Time: `date` $ipAdd network failed" >> $msg ; else echo "Time: `date` $ipAdd network up" >> $msg ; fi echo $curstate > $prevstate echo `cat $prevstate` else echo "status remains the same as of previous" ; fi echo " " done crontab -l gives o/p # /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) # */10 * * * * root /usr/sbin/logrotate /etc/logrotate.conf */30 * * * * /bin/bash /usr/local/sbin/ping/final1.sh >/tmp/ping.err 2>&1 Please help me in this issue. Thanks in advance. Regards Prajakt 9967776567 Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/ [Non-text portions of this message have been removed]