initscripts: Can it restart a service automatically if onecrashes?
Gabriel M. Elder
eldergabriel at charter.net
Sun Jan 4 16:55:30 UTC 2004
Sorry, I don't know about the, er, availability of the High Availability
infrastructure, or where one would go to find such things. However, a
few things worth pointing out:
It might not be the most elegant of solutions, but couldn't one
periodically run a shell script as a cron job that would test for the
running process, and then restart it if it's not running? Maybe
if [ ! $(ps -ef | grep -i processname) ]; then
(you get the general idea...). Depending on uptime/availability
requirements, and overhead tolerance, have it set to run every 1-10
minutes or so.
Another possible scripting solution in your custom init script itself
would be to 'exec' the application from a near-infinite do-while
construct, with a failure exit status as a test. So as long as the
application should be running, and it has failed, execution will return
to the calling script. Increment a variable each time it starts the
application, and include that in your test to set your crash limit?
"Don't bash the script; script the bash!" :p
On Mon, 2003-12-29 at 18:10, Peter Robinson wrote:
> > dragonman at asiayeah.com (Tony Yat-Tung Cheung) writes:
> >> I am going to write an init script for a 3rd party application. I
> >> would like the application to restart itself automatically if it
> >> crashes or core dumps (up to a predefined limit). Does the current
> >> initscripts provide similar functionality?
> >> ...
> >> Thank you. Any idea?
> > The (very limited) LSB initconcept does not support this and you will have
> > to use more advantageous methods like minit or runit. 'supervise' from
> > djb's daemontools might be an interim solution but it has a non-free
> > license and can not be distributed therefore. I do not know if there exists
> > a free implementation of it.
> What about some of the High Availability stuff. I seem to remember there was some HA
> stuff that could monitor ports or processes and restart them if required.
> fedora-devel-list mailing list
> fedora-devel-list at redhat.com
More information about the devel