LinuxSA Mailing list archives

Index: [thread] [date] [subject] [author] [stats]
  From: Alan Kennington <akenning@topology.org>
  To  : LinuxSA <linuxsa@linuxsa.org.au>
  Date: Sat, 26 May 2001 19:35:26 +0930

Re: cron jobs for services

On Fri, May 25, 2001 at 07:04:56PM -0400, Corey Gilmore wrote:
> 
> I was wondering what kind of solutions people use to keep services
> running.  Apache, mysql, bwbar (www.kernel.org) and a few others come to
> mind.  Actually apache and mysql are bad examples seeing as they generate
> a pid file.
> 
> bwbar, is a small app that sits in the background, queries /proc for
> network info, and then writes some files about bandwith usage.  What I
> wand to do is throw this in my web user's crontab - but i don't want to
> spawn a new process everytime the crontab is run.
> 
> Whats the best way to monitor a process (that doesn't generate a pid file)
> and if its not running, restart it?


Try "man startproc".
E.g. it says:

================================================================
DESCRIPTION
       startproc  and  the LSB variant start_daemon check for all
       processes of the specified executable and starts it if  no
       processes  are  found.  Note that startproc is designed to
       start a daemon but not a kernel thread or a program  which
       enables a kernel thread.

       startproc does not use the pid to search for a process but
       the full path of the corresponding program which  is  used
       to  identify  the  executable  (see proc(5)).  Only if the
       inode number  (/proc/<pid>/exe)  and  the  full  name  are
       unavailable  (/proc/<pid>/cmdline)  or  if  the executable
       changes its zeroth argument, startproc uses the base  name
       (/proc/<pid>/stat) to identify the running program. 
================================================================

And so forth.

Cheers,
Alan Kennington.

-- 
LinuxSA WWW: http://www.linuxsa.org.au/  IRC: #linuxsa on irc.linux.org.au
To unsubscribe from the LinuxSA list:
  mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject


Index: [thread] [date] [subject] [author] [stats]
Return to the LinuxSA Mailing List Information Page