in reply to Perl as a background process on Windows NT/2000

I've used srvany.exe from the NT Resource Kit, and can confirm that it works well for running Perl scripts as a service, although last time I used it (a couple years ago) the documentation sucked.

ActiveState also has PerlSvc, part of their Dev Kit, which allows you to compile Perl scripts to be run as services. I haven't used PerlSvc, but I used their compiler (PerlApp) a couple years ago, and if it's as bomber as their compiler, it should work well. (If their compiler was bomber then, I can only imagine it's really spanking nice now!)

However, I don't think your question is exactly "how do I run a Perl script as a service?" but more "how do I run a Perl script once upon a certain event (login) by a user and exit without giving the user any indication that the script is running?" In this case, there is a flag that you can feed to PerlApp (I can't remember what it is, as I haven't used Windows in a couple years, but I remember that it's there) which will keep your executable from popping up a DOS window.

Aside from addressing your concern, compiling your script will give you a couple other advantages: (i) Perl doesn't have to be installed on the machine the compiled script is running on and (ii) you never have to worry about differences in Perl or Perl module versions hosing your script. If you're distributing this to many users and can't count on them keeping their Perl distributions properly administered, (ii) can make a big difference.

Hope this helps!

  • Comment on Re: Perl as a background process on Windows NT/2000