Daemon Process

Chris Hodgins christopher.hodgins at gmail.com
Mon May 16 12:56:32 PDT 2005


On 5/16/05, Giorgos Keramidas <keramida at ceid.upatras.gr> wrote:
> On 2005-05-16 18:48, "Sergey S. Ropchan" <fenix at ramb.com.ua> wrote:
> > Monday, May 16, 2005, 6:41:03 PM, you wrote:
> > > Hi,
> > > I want to know how can I programmatically restart a dead daemon
> > > process in Unix?
> >
> > You can restart daemon process with:
> >
> > kill -HUP `cat /path/to/processname.pid`
> 
> Note the daemon is 'dead'.  You can't signal a dead process.
> 

Hehe.  Perhaps what you want is a cron job that runs a shell script
every 5 mins or so.  The shell script can check for the pid file and
if it does not exist then it restarts the daemon.  If it does find the
pid file then it will probably want to then check if the daemon is
running or not, just incase it died and never cleaned up.  Again if no
process with that pid exists it can restart the daemon.  There are
probably better ways but this is pretty simple.

Chris


More information about the freebsd-questions mailing list