Comiled perl script into Windows service

Discussion in 'Perl' started by rahul_mawana, May 15, 2009.

  1. rahul_mawana

    rahul_mawana New Member

    Joined:
    Apr 4, 2009
    Messages:
    62
    Likes Received:
    0
    Trophy Points:
    0
    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.
     
  2. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~

    Joined:
    May 5, 2009
    Messages:
    1,342
    Likes Received:
    55
    Trophy Points:
    0
    Occupation:
    STUDENT !
    Location:
    Orissa, INDIA
    Home Page:
    http://www.crackingforfun.blogspot.com
    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:
    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\Services\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 :smug:. 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. :wink:


    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:
    instsvr.exe "My Perl Service" REMOVE
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice