in reply to kill a child / parent process

I don't think that srvany gives you any way to catch the "NET STOP". However, there is a similar program in the cygwin package called "cygrunsrv" that sends a signal to the program when NET STOP is used. It worked for me with cygwin perl, but not with ActivePerl 5.8.0 (I think that signal handling is generally screwed up in the latest activeperl). I installed my program like this:
cygrunsrv -I testsrv -p c:/bin/perl.exe -a /home/hirschk/testsrv.pl
and the program testsrv.pl looked like this:
#!perl -w use strict; my $quit = 0; $SIG{TERM} = sub { $quit = 1; }; open OUT, ">>/home/hirschk/srvout"; select(OUT); $|++; print OUT "start time = ", scalar(localtime(time)), "\n"; select(STDOUT); while (1) { sleep(15); if ($quit) { print OUT "quitting at ", scalar(localtime(time)), "\n"; exit(0); } print OUT "time = ", scalar(localtime(time)), "\n"; }