delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/02/20/11:28:23

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Mon, 20 Feb 2012 17:27:24 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: cygrunsrv doesn't stop service during reboot
Message-ID: <20120220162724.GD27701@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <CAKf2h5Qkdu4b1A9dpAsFDHxX-xx-emcKJH+erDD2PdtOjLv80A AT mail DOT gmail DOT com> <20120220155801 DOT GC27701 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <20120220155801.GC27701@calimero.vinschen.de>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Feb 20 16:58, Corinna Vinschen wrote:
> On Feb 20 11:56, Frank Fesevur wrote:
> > Hi,
> > 
> > I have a annoying problem with rsyncd running as a service using
> > cygsunsrv. When I reboot the server running Win2008R2 the service is
> > not properly stopped. Therefore the .pid file stays in /var/run and
> > when the server starts again, the rsync daemon not started because it
> > finds a .pid file.
> > 
> > When I manually stop the service (net stop rsyncd) it works as
> > expected. We don't have this problem on our Win2003 server. The
> > cygrunsrv command is the same on both servers: cygrunsrv -I rsyncd -d
> > "CYGWIN rsyncd" -f "Rsync file transfer daemon" -p /bin/rsync.exe -a
> > "--daemon --no-detach" -O
> 
> It's supposed to work like this:
> 
>   The main thread of cygrunsrv is doing nothing, except waiting for the
>   actual daemon to terminate in a waitpid(2) call.
> 
>   A second thread is called from the Windows service control manager to
>   notify cygrunsrv of the imminent shutdown.  In your case (-O) it gets
>   the SERVICE_CONTROL_PRESHUTDOWN message.  The called function calls
>   kill(2) to kill the daemon.
> 
>   The main thread returns from waitpid(2), checks if the pidfile exists
>   and, if so, syslog's a message to the Windows log (unless you run
>   syslog-ng):
>   
>     "service `rsyncd': removing <pidfile>".
> 
>   Then it unlinks the file and if that didn't work, it syslog's
>   another message:
> 
>     "service `rsyncd': error removing <pidfile> (errno=N)"
> 
> Did you check your log?  Do you see any of these messages?  If not,
> I assume that the shutdown kills the service process so fast that it
> has no chance for the cleanup.  Which is kind of weird in case of
> preshutdown, given that you're supposed to have 3 minutes, at least
> by default...
> 
> > Do I overlook something? Are other people having similar problem with
> > cygrunsrv with win2008R2?
> 
> Interesting.  Given that 2003 doesn't support the control message
> SERVICE_CONTROL_PRESHUTDOWN, it's kind of strange that it works on 2003
> but not on 2008R2.  Did you try to reinstall your rsyncd service without
> the -O option, so that the service acts on the SERVICE_CONTROL_SHUTDOWN
> message instead?

Something else occured to me.  You didn't specify a pidfile on the
cygrunsrv -I command line, so rsyncd will be run by cygrunsrv without
a pidfile.  So, where is the pidfile coming from?  Does rsync create
it by itself in daemon mode?  I just tried this and the answer is no.
Again, from where do you get the pidfile in this scenario?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019