delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/03/02/12:33:25

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
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 <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Patrick Samson <p_samson AT yahoo DOT com>
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: <Pine.GSO.4.56.0403021224440.1337@slinky.cs.nyu.edu>
References: <20040302155658 DOT 93395 DOT qmail AT web60304 DOT mail DOT yahoo DOT com>
MIME-Version: 1.0
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/

- Raw text -


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