X-Spam-Check-By: sourceware.org Date: Tue, 4 Apr 2006 00:20:48 -0400 (EDT) From: Igor Peshansky Reply-To: cygwin AT cygwin DOT com To: "Bryan D. Thomas" cc: cygwin AT cygwin DOT com Subject: Re: how to create a syslog-ng pidfile In-Reply-To: Message-ID: References: <20060402194047 DOT 15398 DOT qmail AT web31307 DOT mail DOT mud DOT yahoo DOT com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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 Mon, 3 Apr 2006, Bryan D. Thomas wrote: > > To generate a pidfile for syslog-ng, should I try the > > -p switch to syslog-ng, (i.e. using the -a argument to > > cygrunsrv) or the -x argument to cygrunsrv? > > I tried removing the service using cygrunsrv, then installing the > service with the changed option. But, when starting the service again, > a pid file was not created using either method. Read below for the description of the -x option to cygrunsrv. > I checked in the source, where I found that the pidfile is created in > the go_background function. This function is not called when the -F > argument is passed to syslog-ng. A variable called do_fork is set to 0. > Only if do_fork is 1 does go_background() get called. So, it is as I > feared, and it is not trivial to get a pid file created. > > Having discovered that this is not a Cygwin-specific issue, I'll stop > adding to the mail volume of this list now. It actually *is* a Cygwin-specific issue, since on most Unix platforms the syslog-ng daemon will not be passed a -F argument, but it is required on Cygwin. > I'm sure there's a good reason for the -F argument to be passed when > syslog-ng is started as a Windows service using cygrunsrv. I am curious > if someone would like to explain this, if it would be of value to those > interested in Cygwin topics. Windows requires services to run continuously until stopped, and also to process certain messages. cygrunsrv is a wrapper program that does the latter, but it needs to be the one controlling the application, so the application essentially needs to run in the foreground. Thus the -F option to syslog-ng (and to httpd, and -D to cron and sshd). For some applications that are unable to work in the foreground, cygrunsrv contains the -x option, which makes it check the pid file instead of waiting for the child process. That way the child can fork and detach, and cygrunsrv can still control it via the pid in that file. But for that to work, the child program now needs to run in detached state. Try specifying the -x option to cygrunsrv, pointing it to the syslog-ng pid file (that you specify via the -p option to syslog-ng), and then *not* specifying the -F option to syslog-ng. HTH, Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com ZZZzz /,`.-'`' -. ;-;;,_ Igor Peshansky, Ph.D. (name changed!) |,4- ) )-,_. ,\ ( `'-' old name: Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte." "But no -- you are no fool; you call yourself a fool, there's proof enough in that!" -- Rostand, "Cyrano de Bergerac" -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/