[dundee] Starting Scripts and Respawning
Kris Davidson
davidson.kris at gmail.com
Fri Mar 25 16:27:36 UTC 2011
You could have a cronjob call a separate script that does the restart:
So put the script in init.d as usual then have a cron like
*/2 * * * * root /root/bin/keepalive.sh > /dev/null
Then put something like this in the script:
/usr/bin/pgrep mysqld
if [ $? -ne 0 ]
then
/etc/init.d/mysql restart
fi
obviously cleaning it up a bit.
On 25 March 2011 14:30, Gary Short <gary at garyshort.org> wrote:
> Okay, so I have a script which I want to start when the machine starts, but
> I will also have to start and stop it manually, so I could put it in
> /etc/init.d. But, I also want it to be respawned by the OS if it get’s
> stopped, so I could put it in inittab, but will that allow me to start/stop
> it manually? What is the best way to get a script to have the following
> properties:
>
>
>
> 1. Start when the machine starts
>
> 2. Respawn if it is stopped
>
> 3. Be manually start/stoppable
>
>
>
> Thanks for your help guys.
>
>
>
> Cheers,
>
> Gary
>
> _______________________________________________
> dundee GNU/Linux Users Group mailing list
> dundee at lists.lug.org.uk http://dundeelug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/dundee
> Chat on IRC, #tlug on irc.lug.org.uk
>
More information about the dundee
mailing list