PDA

View Full Version : running perl script in the background in win2k


biaxident
09-08-2004, 12:10 PM
hi there! I've written a perl server script which i need to run in the background when a user logs in. I tried putting it in the startup folder but the problem is that it runs in a window which a user might close. So how can i run the script in the background without the user knowing? Or as an alternative, put the script in the system tray? Is it possible to run it as a service that can be enabled or disabled?

eric

elam
09-09-2004, 03:48 AM
I was curious about this so I did a Google search (http://www.google.com/search?hl=en&lr=&ie=UTF-8&safe=off&q=%22user+defined+service%22+%22windows+xp%22&btnG=Search). Apparently there is a utility included with XP called sc.exe that allows you to select a program to run as a service.

The syntax is to create is:

sc.exe create "Service Name" binPath="C:\Path to your program.exe"


To remove:

sc.exe delete "Service Name"


I don't know much about perl in Windows, but you may have problems since perl programs are run from a perl executable instead of being executable themselves. Or you could try something like
sc.exe create "Service Name" binPath="C:\perl.exe yourPerlProgram.pl"


But if the perl program extensions are associated properly, I don't see why it wouldn't work.

elam
09-09-2004, 03:50 AM
Oops! Just noticed you said Windows 2000. You have to download a utility pack to get these programs for 2k i think. Google it.

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q137/8/90.asp&NoWebContent=1

CGTalk Moderation
01-19-2006, 05:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.