[Kc] Create Windows Service for Perl Program

djgoku djgoku at gmail.com
Thu May 10 13:41:15 PDT 2007


I found this very useful today (original link: http://tinyurl.com/yrnctw):

Here are some generalized instructions that I use all the time to setup Perl
scripts as services under Windows NT 4.0, 2000, XP, and 2003:

Copy the INSTSRV.EXE and SRVANY.EXE files to C:\WINNT\SYSTEM32.

Run: INSTSRV Service_Name C:\WINNT\SYSTEM32\SRVANY.EXE
(This registers the service.)  Service_name

Set the "Logon As" to Local System Account in the service properties.

Run: REGEDIT
Follow the chain:
 HKEY_LOCAL_MACHINE
    SYSTEM
       CurrentControlSet
          Services
             Service_Name

Add the KEY: Parameters
Select (highlight)  Parameters
Add the String Value: Application
   String: C:\PERL\bin\perl.exe     ( your path to the perl.exe program )
Add the String Value: AppParameters
   String: C:\some_dir\perl_script.pl   ( your path to the perl script to be
run )
Exit the Registry Editor.
Start the Service_Name service.

In the event that you want to remove the Service_Name service, stop the
service and run:
 INSTSRV Service_Name REMOVE

I noticed that there were also a couple articles on Perl Monks, but
that seemed more on the programming side instead of creating a
service. The instsrv.exe and srvany.exe can be had by downloading
windows 2003 server resource kit, though might be other ways.

Jonathan


More information about the kc mailing list