I have found that to run Perl scripts as services, using the NT Resource
Kit srvany.exe tool, in the Parameters/Application key value, you have to
specify the full path of the perl interpreter, followed by the full path of
your script, i.e:
C:\perl\bin\perl.exe C:\mydir\mysubdir\myscript.pl
Not sure if this is your problem here, but it might be worth checking.
Also, as an additional point, in the extract of the script you provided,
what is the point of this line:
#!/usr/bin/perl -w
if you are using a Windows Operating System, not a Unix/Linux one?
HTH,
Phil Morley
Chris Olive
<[EMAIL PROTECTED]> To:
[EMAIL PROTECTED]
Sent by: cc:
[EMAIL PROTECTED] Subject: Problem
with IO::File running .pl as
eState.com NT Service?
23/04/02 05:33
I've got a hot deadline, and I can use all the help/extra eyes I can get to
speed diagnosing this problem...
I don't have time to go into all the background specifics -- those that are
in the know will know what I am talking about here -- but I need to
run/have run a Perl script as a Windows NT service. I use the SRVANY.EXE
image from the Windows 2K Resource Kit, and the instructions on the kit
that go with it. Works fine; been using it on a v1.1 production system for
a while. Just upgraded the Perl script to v1.2, and in trying to run the
script using SRVANY.EXE, it appears not to work.
We all know the debugging routine, right? Write a little test strap and
start finding out what's going on. So I did. It LOOKS LIKE to me that a
Perl module I wrote to create an ASCII log file is the thing that is
keeping this little baby from running. The logging module called
AutoLogger.pm works BEAUTIFULLY from a Command Prompt window. When running
as an NT Service, it appears to keep the script from running properly. The
only module I am using in AutoLogger.pm is IO::File. I know the NT Service
environment isn't the same as the environment one gets at a Command
Prompt. So I'm wondering if there is something squirrly with IO:File in an
NT Service "shell."
Anyway, here's the test strap (works GREAT when I leave the logging calls
out...):
#!/usr/bin/perl -w
use strict;
use Utils qw( :Shell );
use AutoLogger;
my $interval = $ARGV[0] || 60;
## my $log = AutoLogger->new( $ARGV[1] || "NetSend2.log" );
## $log->entry( "Starting loop..." );
## $log->variables( { interval => $interval } );
while () {
## $log->block( "About to shell" );
Shell( qq{net send t00299457 "Parameters: @ARGV"} );
last if (-e "stop");
sleep $interval;
}
## $log->close;
AutoLogger.pm is a bit long to present here. A copy of it can be found at:
http://www.technologEase.com/misc/support/AutoLogger.html
If anyone cares to take a look. I gotta get this solved FAST, so any extra
eyes are welcome... I don't see anything that could behold it up. Like I
said AutoLogger.pm works BEAUTIFULLY in a normal Command Prompt
environment.
Thanks,
Chris
-----
Chris Olive
[EMAIL PROTECTED]
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs