Quoting ktb ([EMAIL PROTECTED]): > #!/bin/sh > # cheknet > > while [ true ]; do > ping -qc 2 10.10.10.9 &> /dev/null > > if [ "$?" -eq 0 ]; then > echo "*** $(date)" >> cheknet.log > else > echo "Network Down ***" >> cheknet.log > /etc/init.d/networking restart >> cheknet.log > echo "--- Network Restarted ---" >> cheknet.log > exit > fi > sleep 5s > done
Two possible solutions to this: 1) Leave it running all the time. Instead of exiting at line 13, break out of that loop into an outer one which sleeps for as long as you are prepared to let your network be down. 2) Touch a file when you start your loop, remove it when the network checks OK before you exit. Check for the presence of the file right at the start and exit if it exists. BTW isn't your exit in the wrong branch? If you restart the network, you need to loop back to ping again to see if it's now up. If ping succeeds (0), you exit. Cheers, -- Email: [EMAIL PROTECTED] Tel: +44 1908 653 739 Fax: +44 1908 655 151 Snail: David Wright, Earth Science Dept., Milton Keynes, England, MK7 6AA Disclaimer: These addresses are only for reaching me, and do not signify official stationery. Views expressed here are either my own or plagiarised.