i need to start a shellscript AFTER full system startup
the script will then run permanently in a loop checking the server every minute and in case of major hangs it just reboots the machine.
i put it into /etc/rc.local file like this:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/checkerscript1 &
/checkerscript2 &
exit 0
now this works, but when i check running processes with "top" i see multiple instances of the script running,
which is definitely not what i want.
how can i start a script correctly after full system startup???
Sorry, without knowing what the script is going to do it would be pure guesswork how best to start the script. It is also usual to build in a means of stopping a background process.
it fetches a small textfile from the local running webserver via curl
if the webserver doesnt respond within 15 seconds the script restarts the webserver.
sleep 120
xxx=`curl -m 15 http://localhost/online.txt`
if [ $xxx == online ]
then
echo running
else
apache2ctl restart
fi
/webservercheck &