|We don't bite newbies here... much|
Check if a process is running on Windowsby davidj (Priest)
|on Jun 13, 2004 at 21:29 UTC||Need Help??|
davidj has asked for the
wisdom of the Perl Monks concerning the following question:
My Fellow Monks,
(I know you will feel my pain)
Woe is me, for I have been tasked with using Perl to ensure another Perl program is running on a win2K machine. I offered to forego my internet privileges for a month if they would let the cup pass, but the Powers-That-Be declined :-)
Here is my situation:
I have a little script that launches on Windows startup. All it does is tail an application log every 5 minutes and then send an email to a particular user if certain messages appear in the log. Very plain, very simple. When I check the Windows machine, I discover that, for some reason, the script is no longer running. I have an error logging facility for it, but nothing in it indicates why it has died. The application whose log it is tailing is still running and everyone who has access to the machine swears they are not killing it. So I have been asked to write something that will check periodically to see if the script has died, and if so, kick it off again. (The Powers-That-Be were not interested in hearing about what would need to be done if the script that checks the script dies also).
So, finally, to my question:
Do any of you know of a way to get a list of all running programs on a Windows machine either my name or process Id? I figure this is the best way to determine if a program is running. I have examined the Win32 modules, but I cannot find anything. If it's in there, I certainly am missing it.
Or, if any of you have any other suggestions for how I might accomplish this task, I am most definately all ears.
as always, your input is greatly appreciated.