Mail Archives: cygwin/2004/03/02/12:33:25
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 -