Subject: Re: [vserver] Graceful shutdown problem
From: "John A. Sullivan III" <jsullivan@opensourcedevel.com>
Date: Wed, 10 Jun 2009 14:09:15 -0400

On Wed, 2009-06-10 at 19:54 +0200, Dennis Roos wrote:
> John A. Sullivan III wrote:
> > On Wed, 2009-05-13 at 08:05 -0500, Michael S. Zick wrote:
> >   
> >> On Wed May 13 2009, John A. Sullivan III wrote:
> >>     
> >>> On Wed, 2009-05-13 at 07:44 -0500, Michael S. Zick wrote:
> >>>       
> >>>> On Wed May 13 2009, John A. Sullivan III wrote:
> >>>>         
> >>>>> Hello, all.  We are having a problem with graceful shutdown of our
> >>>>> vservers.  For example, one of our vservers is a Zimbra email system.
> >>>>> It is set to start and stop as part of vservers-default.  Since email
> >>>>> systems can take quite a while to shut down, we created
> >>>>> a /etc/vservers/zimbra1/apps/vshelper/sync-timeout file and with
> >>>>> contents of:
> >>>>> 900
> >>>>>
> >>>>> However, if we shutdown the vserver host, e.g., halt -p, we notice the
> >>>>> default server shutdown is very fast - much too fast to be adequate for
> >>>>> Zimbra.  As a result, when the server reboots, we have serious damage to
> >>>>> the email database.
> >>>>>
> >>>>> Other than some kludge such as inserting a long sleep sequence in a
> >>>>> shutdown script, is there an elegant way of giving the vservers adequate
> >>>>> time to shut down when the host is shut down? Thanks - John
> >>>>>
> >>>>>           
> >>>> Would it be possible to make the e-mail server send you (system root) a
> >>>> "I am dead" e-mail as the last action in closing out the pending mail files?
> >>>> Or maybe "watch" for its pid file to disappear?
> >>>>
> >>>> Mike
> >>>>
> >>>>
> >>>>         
> >>> That's a good idea; we could create a script in the shutdown sequence
> >>> that will sleep as long as the pid exists.  But I wonder if there is
> >>> something built into vserver that I missed which would create a more
> >>> graceful shutdown.  I thought that's what sync-timeout does but I must
> >>> have guessed wrongly! Thanks - John
> >>>       
> >> The utility library, libevent, should let you write a "Goodbye World" style
> >> program that will block until the pid file disappears.
> >>
> >> Mike
> >>
> >>
> >>     
> > Thanks again.  The downside is I must do this for each vserver.  I'm
> > hoping there is something within vserver which will do this for all
> > vservers automatically, this being shut them down gracefully.  If not,
> > we will resort to your very helpful suggestion - John
> >   
> Hope this isn't too late... recently got back in touch with vservers, so 
> wandering through the mailing list ;)
> 
> I guess you could use /etc/vservers/.defaults/scripts/pre-stop to use to 
> stop zimbra before anything else.
> 
> 
> Hope that helps,
> Dennis
Thanks.  Ultimately, this did not appear to be a shutdown problem.
Rather, it was related to the problem we uncovered regarding Zimbra,
MySQL/InnoDB, and hashify.  All appears to be working now - John
-- 
John A. Sullivan III
Open Source Development Corporation
+1 207-985-7880
jsullivan@opensourcedevel.com

http://www.spiritualoutreach.com
Making Christianity intelligible to secular society