[OT] secure script without cron?
I've been searching though the archives, HOWTO's and online. Can't seem
to find what I'm looking for. Networking on my mail server stopped
working the other day. Restarting the network solved the glitch.
I've created the script below to automate this in the event it happens
again. My question is, how do I run this script in a secure manner?
"/etc/init.d/networking restart." needs to be started as root.
If I set it up in cron and restarting the network doesn't solve the
problem, "networking" will be in a loop. I could source the command
/etc/init.d/networking restart" from a file and in the event of a
failure "mv" the file so the cron job couldn't access "networking."
That seems like a clunky hack. I don't think sudo will work in this
Any thoughts or pointers appreciated.
while [ true ]; do
ping -qc 2 10.10.10.9 &> /dev/null
if [ "$?" -eq 0 ]; then
echo "*** $(date)" >> cheknet.log
echo "Network Down ***" >> cheknet.log
/etc/init.d/networking restart >> cheknet.log
echo "--- Network Restarted ---" >> cheknet.log
From seeing and seeing the seeing has become so exhausted
First line of "The Panther" - R. M. Rilke