Comiled perl script into Windows service

rahul_mawana's Avatar, Join Date: Apr 2009
Contributor
Hello friends i want to make my perl script as a windows service..
any idea how can i do this..
i have converted my perl script into exe using perlsv.
SaswatPadhi's Avatar, Join Date: May 2009
~ Б0ЯИ Τ0 С0δЭ ~
If you have converted your Perl script to exe, then adding it as a Windows service should not be difficult.

You need to have the Windows NT Resource Kit that contains two required files :
(1) Instrsrv.exe to add/remove services from Windows NT/2000
(2) Srvany.exe to allow any Windows application to run as a service.

You can download it (WinNT_Kit.zip) from my box using the link : http://www.box.net/shared/6pzb9xx0k0 .

Now, how to add the service :

(1) Extract WinNT_Kit.zip to any directory, say C:\NT_Kit\.
(2) Get a command prompt at that directory.
(3) Add a new service by using the command :
Code: DOS
instsvr.exe "My Perl Service" srvany.exe
Enter a desired name in place of My Perl Service, within the quotes.
(4) Open the Registry Editor (Start --> Run --> regedit.exe)
(5) Navigate to the key :
Next navigate to this registry key.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\My Perl Service\
(6) Right-Click in the right-hand-side pane --> New --> Key. Name the new key as Parameters. Be sure to create it under your service-name.(in this case My Perl Service)
(7) Expand the Parameters key --> Right-click in right-side pane --> New --> String Value.
(8) Enter the name of the value as Application.
(9) Enter its value as the path to the exe which you want to add as service.
(10) Now your service is added . You can start it from the Service Manager (Start --> Run --> Services.msc).

If you want your service to be started automatically at the Windows logon, you can specify the startup type as Automatic.


Hope this will be useful to you.

PS : If you want to remove the service later, you can navigate to C:\NT_Kit\ and get a DOS prompt there, then execute :
Code: DOS
instsvr.exe "My Perl Service" REMOVE