Kris's answer is bob on :)<br><br><div class="gmail_quote">On Fri, Mar 25, 2011 at 4:20 PM, Kris Davidson <span dir="ltr"><<a href="mailto:davidson.kris@gmail.com">davidson.kris@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
You could have a cronjob call a separate script that does the restart:<br>
So put the script in init.d as usual then have a cron like<br>
<br>
*/2 * * * * root /root/bin/keepalive.sh > /dev/null<br>
<br>
Then put something like this in the script:<br>
<br>
/usr/bin/pgrep mysqld<br>
<br>
if [ $? -ne 0 ]<br>
then<br>
/etc/init.d/mysql restart<br>
fi<br>
<br>
obviously cleaning it up a bit.<br>
<div><div></div><div class="h5"><br>
On 25 March 2011 14:30, Gary Short <<a href="mailto:gary@garyshort.org">gary@garyshort.org</a>> wrote:<br>
> Okay, so I have a script which I want to start when the machine starts, but<br>
> I will also have to start and stop it manually, so I could put it in<br>
> /etc/init.d. But, I also want it to be respawned by the OS if it get’s<br>
> stopped, so I could put it in inittab, but will that allow me to start/stop<br>
> it manually? What is the best way to get a script to have the following<br>
> properties:<br>
><br>
><br>
><br>
> 1. Start when the machine starts<br>
><br>
> 2. Respawn if it is stopped<br>
><br>
> 3. Be manually start/stoppable<br>
><br>
><br>
><br>
> Thanks for your help guys.<br>
><br>
><br>
><br>
> Cheers,<br>
><br>
> Gary<br>
><br>
</div></div><div><div></div><div class="h5">> _______________________________________________<br>
> dundee GNU/Linux Users Group mailing list<br>
> <a href="mailto:dundee@lists.lug.org.uk">dundee@lists.lug.org.uk</a> <a href="http://dundeelug.org.uk" target="_blank">http://dundeelug.org.uk</a><br>
> <a href="https://mailman.lug.org.uk/mailman/listinfo/dundee" target="_blank">https://mailman.lug.org.uk/mailman/listinfo/dundee</a><br>
> Chat on IRC, #tlug on <a href="http://irc.lug.org.uk" target="_blank">irc.lug.org.uk</a><br>
><br>
<br>
_______________________________________________<br>
dundee GNU/Linux Users Group mailing list<br>
<a href="mailto:dundee@lists.lug.org.uk">dundee@lists.lug.org.uk</a> <a href="http://dundeelug.org.uk" target="_blank">http://dundeelug.org.uk</a><br>
<a href="https://mailman.lug.org.uk/mailman/listinfo/dundee" target="_blank">https://mailman.lug.org.uk/mailman/listinfo/dundee</a><br>
Chat on IRC, #tlug on <a href="http://irc.lug.org.uk" target="_blank">irc.lug.org.uk</a></div></div></blockquote></div><br><br clear="all"><br>-- <br><br>Nick Walker<br>President : The Linux Society<br>UAD Ethical Hacker<br>