up vote 2 down vote favorite
2
share [g+] share [fb]

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.

link|improve this question

70% accept rate
feedback

1 Answer

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.

link|improve this answer
great ! any advantages on using FireDaemon, or Win32::Daemon ??? – s.mihai Jun 7 '09 at 15:03
well... FireDaemon dosen't seem to be open source, since i am interested in a $$$ less solution :D – s.mihai Jun 7 '09 at 15:05
1  
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 – splattne Jun 7 '09 at 15:11
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. – s.mihai Jun 7 '09 at 15:12
You can also use par instead of perl2exe to create executables of your perl scripts. (free and available from CPAN) – moshen Jun 25 '09 at 21:07
show 1 more comment
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.