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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|