All services run under a service account. Typically this is "LocalSystem" or
"Network Service" (if you are using XP or .Net Server). However it could be
any valid Windows user account. Make sure that whatever account you are
running the service under has proper permissions and privileges to shell out
and open a file for r/w.

You may also want to consider using Win32::Daemon instead of Srvany.exe. It
provides your script with true Win32 service functionality thus provides you
with more service like capabilities.

dave

-----Original Message-----
From: Chris Olive [mailto:[EMAIL PROTECTED]] 
Sent: Monday, April 22, 2002 9:33 PM
To: [EMAIL PROTECTED]
Subject: Problem with IO::File running .pl as NT Service?


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

Reply via email to