[NTLUG:Discuss] Script help

Fred fredstevens at yahoo.com
Tue Sep 14 11:15:11 CDT 2010


I am somewhat embarassed because I can't remember how to do this:

I wrote a little script that works just fine when I invoke it manually
but when I put it into the /etc/init.d startup scrip "local" (where I have
other misc scripts) it refuses to start... or continue to run after the
rc5.d quits, or whatever. Bottom line is that when I do a ps -ef |grep 
<scriptname>
it is not running.

The script:

#########################################
#
# pingtest
#
# A network test tool
#

LOG=/etc/netup.log

while true
do
      date >> $LOG

#      ping -c1 199.2.252.10 >> $LOG

        count=$(ping -c1 199.2.252.10 | grep 'received' | awk -F',' '{ print $2 
}' | awk '{ print $1 }')
          if [ $count -eq 0 ]; then
                      # 100% failed
                      echo "Net down" >> $LOG
          fi

sleep 60
done

-------------------

Entry in my /etc/init.d/local:

/etc/pingtest &
(I have tried several different invocations, all with the same result)

With this tool, any time I think my dsl service is hosed I simply grep down 
<logfile>
and if it is, I call the provider. I am trying to build a case for them to fix 
their crappy
server. It has been a long running struggle.

Thanks for any help,
Fred



      



More information about the Discuss mailing list