Using watch to run a shell script - but the script goes defunct
Posted
by
PHP-Steven
on Server Fault
See other posts from Server Fault
or by PHP-Steven
Published on 2011-11-18T23:48:15Z
Indexed on
2011/11/19
1:54 UTC
Read the original article
Hit count: 569
So I want to keep an eye on my network connectivity so I can make a report for my ISP. (seems like the modem goes out for about 30-60 seconds about once a day)
So I copied this handy little script
And an running it with
watch -n 15 ./ping-test.sh
I have been testing it by pulling the plug on my modem.
The first time watch runs the script after the network goes out it runs fine (sends some email) and then goes defunct. Once networking is restored the script "finishes" and then watch runs it again.
So I'm getting mail for when the network goes down, but not how long it was down for.
If I run the script straight from the command line it runs (emails) and then exits.
Any ideas why? How can I get the script to keep running once the network is down?
© Server Fault or respective owner