Run perl script as a windows service
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.
Related videos on Youtube
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, 2022Comments
-
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 about 15 yearsgreat ! any advantages on using FireDaemon, or Win32::Daemon ???
-
Wegged about 15 yearswell... FireDaemon dosen't seem to be open source, since i am interested in a $$$ less solution :D
-
splattne about 15 yearsHmm, 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 about 15 yearsand 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 almost 15 yearsYou can also use par instead of perl2exe to create executables of your perl scripts. (free and available from CPAN)
-
moshen almost 15 yearsForgot to add the link: search.cpan.org/~smueller/PAR-0.992/lib/PAR.pm