[dundee] Starting Scripts and Respawning

Nicholas Walker tel0seh at googlemail.com
Sat Mar 26 12:13:57 UTC 2011


Kris's answer is bob on :)

On Fri, Mar 25, 2011 at 4:20 PM, Kris Davidson <davidson.kris at gmail.com>wrote:

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



-- 

Nick Walker
President : The Linux Society
UAD Ethical Hacker
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/dundee/attachments/20110326/7054ec67/attachment.htm>


More information about the dundee mailing list