run a shellscript in background after startup

hi.

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???

thanks for any answers!

Can you post the scripts? What you show so far will not cause multiple running copies. Maybe the script calls itself?

yeah, the script calls itself.
then thats the problem.

now i call the script itself with a & at the end and it works fine now.

thanks sir, great help

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.

well the script does this:

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 &

works fine now.