[Zope] OT Perl daemon to restart hung Zope on RedHat

Dunigan, Craig craig.dunigan@esker.com
Mon, 2 Jul 2001 09:42:33 -0500


An "open console" means that somebody has to be logged into the machine for
the script to run.  Exit the logged in session, and all running jobs,
background and foreground, get killed.  That means that, since I have remote
servers, I'd have to leave one xterm window running on my Linux workstation
for each remote server, logged into the server via ssh or whatever.  If my
workstation has a power outage, that process on the remote server dies.  No
problem if I'm here every day, but if I go on vacation, there's no one else
here who knows anything at all about Linux or Zope, and our servers go
unprotected, and the people in California complain that they can't get to
the intranet, and my boss complains to me.  Or that's roughly how it
happens.

Perhaps a better way to think of 'an open console' is that the process (our
script) expects to find a STDIN, a STDOUT, and a STDERR, which are normally
attached to a display, also called a console.  A daemon forks a child, which
creates its own set of these, as well as sets up its own signal handler
separate from the parent.  This effectively disconnects the child from a
display, so that when we close STDx (on the parent) and kill the parent, the
child won't catch the signal to close that comes when we close the display
by logging out.  More or less, since I'm speaking largely from half-recalled
theory, that's why just backgrounding, as well as simply starting a
non-daemon script from an rc init script, as someone else suggested, won't
work.  However, I'm sure someone with more knowledge and experience could
explain it in greater (and more exact!) detail.

Craig Dunigan
Web Programmer
Esker Software - Extending the Reach of Information
mailto:craig.dunigan@esker.com
Ph. 608.273.6000
Fax 608.273.8227
http://www.esker.com

> -----Original Message-----
> From: Jerome Alet [mailto:alet@unice.fr]
> Sent: Monday, July 02, 2001 2:27 AM
> To: Dunigan, Craig
> Cc: zope@zope.org
> Subject: RE: [Zope] Perl daemon to restart hung Zope on RedHat
> 
> 
> On Fri, 29 Jun 2001, Dunigan, Craig wrote:
> 
> > > I don't use it since Zope 2.1.6, because I've not 
> experienced any hang
> > > since this date. However I've just looked at the code and I can't
> > > see anything which would prevent it from being run in the 
> background:
> > > 
> > > 	isdazope.py [options] &
> > > 
> > > I don't know how to really daemonize it, though.
> > 
> > As I'm sure you know, 
> 
> No ! I don't.
> 
> > but for the benefit of others who might not,
> > backgrounding it still needs an open console to run, and 
> that is what I
> > wanted to avoid.  Oh well, maybe someone who knows about 
> making a Python
> > daemon could step in at this point and save us?
> 
> What do you mean by: "needs an open console to run" ?
> 
> Thanks in advance.
> 
> Jerome Alet
>