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.

In reply to Re: USB Drive Letter Assignment in Win32 by inman
in thread USB Drive Letter Assignment in Win32 by traveler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.