Re: Trying to start a perl script as Windows Service




Quoth "dn.perl@xxxxxxxxx" <dn.perl@xxxxxxxxx>:
On Sep 28, 5:30 pm, Ben Morrow <b...@xxxxxxxxxxxx> wrote:

To run an arbitrary program as a windows service you need to use srvany
from the Resource Kit. I don't really know why, but it's to do with how
Windows expects a service to behave.
Seehttp://support.microsoft.com/kb/137890.


I have used srvany from the Resource Kit and followed the steps from
the above URL. But the service stops immediately after I start it. It
is supposed to print one line every 20 seconds to a file in an
infinite loop. It is not supposed to print anything to stdout, so it
should really run in the background and the question of it having 'no
place' to print (as suggested by Bill H) does not exist. Some services
stop after starting because 'they have nothing to do'. But this
process does have something to do and yet it stops.

Can you try reopening STDERR to a file somewhere (probably best if you
open it in append mode) *really* early on in your script? Something like

BEGIN {
# no point giving a sensible message as there's nowhere for it
# to go :(
open STDERR, '>>', 'c:/path/to/log.file' or die;
}

right at the top. Then you've got more of a chance of finding out what's
wrong. I suspect it's some sort of environment issue: perhaps the local
SYSTEM user doesn't have some permission it requires?

Ben

.



Relevant Pages


Loading