None of the above worked for me on Windows 7 64-bit, but they did lead me in the right direction. The Non-Sucking Service Manager ended up being the key. Below is the code for the two .bat scripts needed to install a Perl script as a service in Windows 7 64-bit. It should also work in 32-bit versions, but I have not been able to test this yet.
install_service.bat
@echo off
if defined %ProgramFiles(x86)% (
"%ProgramFiles(x86)%\path_to\your_app\service\nssm.exe" install my
+Service "C:\Program Files (x86)\path_to\your_app\portable_perl\perl\b
+in\perl.exe" """C:\Program Files (x86)\path_to\your_app\myService.pl"
+""
) else (
"%ProgramFiles%\path_to\your_app\service\nssm.exe" install myServi
+ce "C:\Program Files\path_to\your_app\portable_perl\perl\bin\perl.exe
+" """C:\Program Files\path_to\your_app\myService.pl"""
)
net start myService
exit
remove_service.bat
@echo off
net stop myService
if defined %ProgramFiles(x86)% (
"%ProgramFiles(x86)%\path_to\your_app\service\nssm.exe" remove myS
+ervice confirm
) else (
"%ProgramFiles%\path_to\your_app\service\nssm.exe" remove myServic
+e confirm
)
exit
-
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.
|