in reply to USB Drive Letter Assignment in Win32

Running a Perl script as a service is actually very easy and requires no extra coding. The only thing that I have noticed with the following method is that the script doesn't really shut down. It is just stopped.

Any script can be run as a service if you use the srvany application that comes with the Windows Reource Kit tools. Download the resource kit from microsoft and read the documentation regarding InstSrv.exe and SrvAny.exe. The first tool installs a service. The service that you install is SrvAny. Registry settings for SrvAny tell it which application to run as a service.

The following are some notes that I made for a Perl App that is installed as a service.

Manual Installation =================== Manual installation requires that the INSTSRV.EXE utility is used to i +nstall the service. The Service is subsequently configured by creating registry s +ettings. 1. run INSTSRV.EXE SERVICENAME C:\path\SRVANY.EXE 2. configure the parameters etc. in the registry as described below 3. Start the service Registry Settings ================= [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SearchWatcher\Pa +rameters] "Application"="C:\\Perl\\bin\\Perl.exe" "AppParameters"="SearchWatcher.pl SearchWatcher.ini" "AppDirectory"="C:\\SearchWatcher\\SearchWatcher" Application is the executable to run. AppParameters are any parameters that are to be passed to the applicat +ion AppDirectory is the working directory to use.

Replies are listed 'Best First'.
Re^2: USB Drive Letter Assignment in Win32
by shonorio (Hermit) on Jun 07, 2004 at 12:59 UTC
    Hi inman

    I do not recomend to use 'srvany.exe' to make Perl system running as services for 2 reasons:

    1o. System running as a services is little be different of normal system, and if we use one external program to run as a service we don't take care about this difference
    2o. It's so easy to use Win32::Daemon module, and you can take control of Services Queue Message, where you can do something before stop services or shutdown Windows.

    On my opinion, if we don't want take care about extra coding we can use the Windows Schedule. I think it's better than use 'srvany.exe'.

    That's my opinion

    Solli Moreira Honorio
    Sao Paulo - Brazil