Tell me more ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a daemon/service (milter-regex), that is dying. I'm only using it temporarily (A few months), so don't care too much, but I want it to restart when it dies.

It is an init.d script. 'service milter-regex start' etc. The init script lives at /etc/init.d/milter-regex

I know if I have something in /etc/inittab, it will automagically respawn if it dies. Are init scripts supposed to do this as well, or do I need to put it in inittab?

It could be failing to restart as it isn't cleaning up a stale sock file, which I will fix today, but thought I'd ask the question anyway.

Running on RHEL4 (Yes, old)

Thanks, Brock

share|improve this question
Can you edit the question to be better organized and clear? What is the content of the script in question, etc. – vgoff Nov 14 '12 at 22:23
@vgoff My question wasn't about the script, just about if daemons started via 'service nameofdaemon start' were supposed to respawn automatically. Adding the content of the script would make my question less clear. – Brock Nov 14 '12 at 23:34

1 Answer

up vote 1 down vote accepted

Scripts in init.d don't get rerun automatically when the service crashes. If you want to do the minimum amount of work to make sure it runs, inittab may be your best bet. It's icky though, almost as icky as still running RHEL 4.

share|improve this answer
Can I clean up a sock file in inittab? 'mrx:2345:respawn:rm -f sock;milter-regex' Or will that do something weird like attempt to keep rm running? – Brock Nov 14 '12 at 22:15
I wouldn't try that... maybe wrap milter-regex in a script that deletes the socket and exec's milter-regex. – Dennis Kaarsemaker Nov 14 '12 at 22:31
OK. Thanks for your help. – Brock Nov 14 '12 at 22:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.