Run perl script as a windows service

6,205

You could try the procedure descibed on this page:

Install a perl script as a Win NT/2000/XP service.

This perl script uses srvany and instsrv (two free programs from Microsoft; put on my perlmonk.org website for ease of linking) to install a perl script as a Windows NT/2000/XP service.

In the comments on the same page there a some interesting options:

I prefer to compile my scripts with perl2exe and install the binary as a service. I've used instsrv and srvany, but I prefer to use the freely available FireDaemon.

and

You might also consider Win32::Daemon for a pure-perl solution.


As alternative you could also try ExeService, a program which allows you to run executables, scripts and commands as Windows Services.

Share:
6,205

Related videos on Youtube

Wegged
Author by

Wegged

Sysadmin of a small network ~30pc's 2 servers. I like IT, and i'm doing this as an extra responsability at my job. Keeping IT in the company works great for us :)

Updated on September 17, 2022

Comments

  • Wegged
    Wegged over 1 year

    How do you run a perl script as a windows service?

    I have a script that gathers all sort of data and then relays them to a server, but I need to run this as a system service in order to report data all the time.

  • Wegged
    Wegged about 15 years
    great ! any advantages on using FireDaemon, or Win32::Daemon ???
  • Wegged
    Wegged about 15 years
    well... FireDaemon dosen't seem to be open source, since i am interested in a $$$ less solution :D
  • splattne
    splattne about 15 years
    Hmm, Win32::Daemon appears not to be available for current perl versions. See this updated code from the author of the first link: perlmonks.org/?node_id=744578
  • Wegged
    Wegged about 15 years
    and perl2exe is a eval version, that inserts a message at the end of my script, as well as a 2sec delay at the end.
  • moshen
    moshen almost 15 years
    You can also use par instead of perl2exe to create executables of your perl scripts. (free and available from CPAN)
  • moshen
    moshen almost 15 years