Ping hangs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings!

I have a simple script running on my firewall that simply sends a
single ping packet to a web site I trust every minute.  If the ping
fails, I assume my DSL line went down... again.  

All works fine, until the router sends back a "no route to host" type
message.  When this happens, the ping command simply hangs.  It never
returns and I quickly have a few hundred ping commands sleeping in my
process table.

I get around this problem by running a script every hour that looks for
> 5 ping commands and runs a killall if it is true.  However, is this a
bug in ping?  Since I am seeing the "no route" message, I have to assume
ping knows what it is getting, it simply never exits.

Here's my script.  (Be kind.  I'm not a programmer.)


#!/bin/sh

ret_var=0

LOG_FILE=/var/log/ping_log
TARGET_IP="www.kcpt.org"

# echo log to $LOG_FILE

if ping -c 1 $TARGET_IP >> /dev/null  { If you put >> $LOG_FILE here
you can see the no route stuff }
{ The lines below are never executed if the ping packet returns no
route to host message. }
then
    echo `date` "Ping Succeeded" $TARGET_IP >> $LOG_FILE
else
    echo `date` "Ping Failed" $TARGET_IP >> $LOG_FILE
fi

{ Notification stuff goes here, but you get the idea. }

Thanx!

-Michael




[Index of Archives]     [Fedora Users]     [Centos Users]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat Phoebe Beta]     [Yosemite Forum]     [Fedora Discussion]     [Gimp]     [Stuff]     [Yosemite News]

  Powered by Linux