Perl script into a Windows Service

Discussion in 'Perl Misc' started by Cosmic Cruizer, Feb 6, 2004.

  1. For the last several months, I have been trying to turn a simple Perl script
    into a Windows 2000 service. I keep finding a lot of question about doing
    this in newsgroups, but I have yet to find an easy to follow solution. Can
    anybody recommend either a book, web page, article, or something that will
    help me out? It almost sounds like setting up a Perl script to run as a
    service is an urban legend.

    Thanks,
    Cosmic Cruizer, Feb 6, 2004
    #1
    1. Advertising

  2. Cosmic Cruizer

    Chris Guest

    Cosmic Cruizer wrote:
    > For the last several months, I have been trying to turn a simple Perl script
    > into a Windows 2000 service. I keep finding a lot of question about doing
    > this in newsgroups, but I have yet to find an easy to follow solution. Can
    > anybody recommend either a book, web page, article, or something that will
    > help me out? It almost sounds like setting up a Perl script to run as a
    > service is an urban legend.
    >


    No, it's not an urban legend. It's actually not that hard to do.
    Recent versions of Perl make this rather easy to do. I know this sounds
    weird, but I don't have access to the Web right now to find what I know
    is out there, but do some searching on Dave Roth -- he's king of Perl
    Win32 and I know I saw some outlines from him within the last two years
    on the preferred way to create WinNT-based services using ActiveState Perl.

    The poor man's method, which works best for older versions of
    ActiveState Perl (esp. 5.00x) is to use Microsloth's SRVANY.EXE
    executable. Look in Microsloth's (pathetic) Support/KB engine for
    SRVANY.EXE and see what you come up with. There is a KB article that
    explains the registry pokes/insertions that need to be done to setup
    your own service using a script and SRVANY.EXE.

    Writing an installer to install an app using either method is not hard
    to do either.

    I can be more specific about the SRVANY.EXE method if you need more
    guidance. Hope this gets you going.

    Chris
    -----
    Chris Olive
    chris -at- --spammers-are-vermin-- technologEase -dot- com
    http://www.technologEase.com
    (pronounced "technologies")
    Chris, Feb 7, 2004
    #2
    1. Advertising

  3. Cosmic Cruizer

    Andy Hassall Guest

    On Fri, 06 Feb 2004 21:52:52 GMT, (Cosmic Cruizer)
    wrote:

    >For the last several months, I have been trying to turn a simple Perl script
    >into a Windows 2000 service.


    http://theoryx5.uwinnipeg.ca/CPAN/data/Win32-Daemon-Simple/Simple.html

    --
    Andy Hassall <> / Space: disk usage analysis tool
    <http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>
    Andy Hassall, Feb 7, 2004
    #3
  4. Andy Hassall <> wrote in <jec8205j9h5lt6pccf7aihusui37c5s3i2
    @4ax.com>:

    >http://theoryx5.uwinnipeg.ca/CPAN/data/Win32-Daemon-Simple/Simple.html


    Thanks Andy and Chris.

    The link listed above is pretty easy to follow. I will need to give it a try
    when I have a bit more time.

    Since I finally needed to get something up and running for the weekend, I
    kind of cheated. I'm trying out Firedaemon. It took me all of 10 minutes to
    get my service up and running. But the real test will be on Monday when I
    check out the server.

    Thanks for the suggestions.
    Cosmic Cruizer, Feb 7, 2004
    #4
  5. "Cosmic Cruizer" <> wrote in message
    news:Xns94878D34DB897ccruizermydejacom@64.164.98.51...
    > For the last several months, I have been trying to turn a simple Perl

    script
    > into a Windows 2000 service. I keep finding a lot of question about doing
    > this in newsgroups, but I have yet to find an easy to follow solution. Can
    > anybody recommend either a book, web page, article, or something that will
    > help me out? It almost sounds like setting up a Perl script to run as a
    > service is an urban legend.
    >
    > Thanks,


    Here are some generalized instructions that I use all the time to setup Perl
    scripts as services under Windows NT 4.0, 2000, XP, and 2003:

    Copy the INSTSRV.EXE and SRVANY.EXE files to C:\WINNT\SYSTEM32.

    Run: INSTSRV Service_Name C:\WINNT\SYSTEM32\SRVANY.EXE
    (This registers the service.) Service_name

    Set the "Logon As" to Local System Account in the service properties.

    Run: REGEDIT
    Follow the chain:
    HKEY_LOCAL_MACHINE
    SYSTEM
    CurrentControlSet
    Services
    Service_Name

    Add the KEY: Parameters
    Select (highlight) Parameters
    Add the String Value: Application
    String: C:\PERL\bin\perl.exe ( your path to the perl.exe program )
    Add the String Value: AppParameters
    String: C:\some_dir\perl_script.pl ( your path to the perl script to be
    run )
    Exit the Registry Editor.
    Start the Service_Name service.

    In the event that you want to remove the Service_Name service, stop the
    service and run:
    INSTSRV Service_Name REMOVE

    I hope this helps.

    Kevin Sproule
    Kevin Sproule, Feb 8, 2004
    #5
  6. "Kevin Sproule" <> wrote in
    <D_uVb.25464$tP1.18372@fed1read07>:

    >
    >Here are some generalized instructions that I use all the time to setup
    >Perl scripts as services under Windows NT 4.0, 2000, XP, and 2003:
    >
    >Copy the INSTSRV.EXE and SRVANY.EXE files to C:\WINNT\SYSTEM32.
    >
    >Run: INSTSRV Service_Name C:\WINNT\SYSTEM32\SRVANY.EXE
    >(This registers the service.) Service_name
    >
    >Set the "Logon As" to Local System Account in the service properties.
    >
    >Run: REGEDIT
    >Follow the chain:
    > HKEY_LOCAL_MACHINE
    > SYSTEM
    > CurrentControlSet
    > Services
    > Service_Name
    >
    >Add the KEY: Parameters
    >Select (highlight) Parameters
    >Add the String Value: Application
    > String: C:\PERL\bin\perl.exe ( your path to the perl.exe program
    > )
    >Add the String Value: AppParameters
    > String: C:\some_dir\perl_script.pl ( your path to the perl script
    > to be
    >run )
    >Exit the Registry Editor.
    >Start the Service_Name service.
    >
    >In the event that you want to remove the Service_Name service, stop the
    >service and run:
    > INSTSRV Service_Name REMOVE
    >
    >I hope this helps.
    >
    >Kevin Sproule
    >
    >
    >


    WOW... Talk about easy. Thanks.
    Cosmic Cruizer, Feb 11, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wet Basement
    Replies:
    1
    Views:
    2,505
    BobMonk
    Jul 15, 2003
  2. dpackwood
    Replies:
    3
    Views:
    1,767
  3. Jeffery Jones

    Perl script as Windows service fails to run

    Jeffery Jones, Apr 14, 2006, in forum: Perl Misc
    Replies:
    3
    Views:
    136
    Jeffery Jones
    Apr 15, 2006
  4. Replies:
    5
    Views:
    176
  5. Replies:
    11
    Views:
    267
Loading...

Share This Page