Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Tue, 2 Mar 2004 12:32:33 -0500 (EST) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Patrick Samson cc: cygwin AT cygwin DOT com Subject: Re: stdout/stderr handling by cygrunsrv/bash/tcl In-Reply-To: <20040302155658.93395.qmail@web60304.mail.yahoo.com> Message-ID: References: <20040302155658 DOT 93395 DOT qmail AT web60304 DOT mail DOT yahoo DOT com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-ID: Content-Disposition: INLINE X-Scanned-By: MIMEDefang 2.39 On Tue, 2 Mar 2004, Patrick Samson wrote: > I run a service installed as: > > cygrunsrv --install pgr-daemon > --path /usr/bin/bash.exe > --args "--login /opt/pgreplica/bin/pgrd host1 host2" > --user pgreplicator > --shutdown > > Everything is fine with stdout. Messages are in /var/log/pgr-daemon.log > > But if my application, which is a TCL script, writes something on stderr > (as "puts stderr $msg"), > This message is written: > - at the beginning of the file, overwriting the existing stdout text. > - only when the service is stopped. > > Is it an as-is behaviour, a lack or a mistake in the command syntaxes, > or something wrong in cygrunsrv or bash or tcl? Patrick, WFM. I can't reproduce your problem on Win2k (without Tcl and --user). Here's what I did: $ mkdir /tmp/servicetest && cd /tmp/servicetest $ cat > service.sh #!/bin/bash terminate() { echo "Terminating" >&2 exit 0 } trap terminate INT echo "Starting service" >&2 trap -p while true; do sleep 10 echo "STDERR" >&2 echo "STDOUT" >&1 done $ cygrunsrv --install test-daemon --path /usr/bin/bash.exe --args "--login /tmp/servicetest/service.sh" --termsig INT --shutdown $ cygrunsrv -S test-daemon; sleep 30; cygrunsrv -E test-daemon $ cat /var/log/test-daemon.log Starting service trap -- 'terminate' SIGINT STDERR STDOUT STDERR STDOUT STDERR STDOUT Terminating $ So, messages going to stdout/stderr were properly redirected. If the above works for you, try adding a Tcl call to the test script, and see if it changes anything. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "I have since come to realize that being between your mentor and his route to the bathroom is a major career booster." -- Patrick Naughton -- 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/