I'm not too deep on Win32 processes but...
Win32 processes are much heavier than *nix counterparts. If you'd like
to stop/start a independent process, I have the following ideas:
1. A simple file existence check on the process' part. Stop if the file
exists, once the file is removed, continue.
2. Open up a listening socket port on the process for start/stop commands.
I prefer these methods, as they allow the process to shutdown gracefully.
But if you really need to kill a process, yes; please use the Win32 methods.
Bernie Cosell wrote:
I'm a pretty experienced Perl programmer, but only on Unix and I'm a rank
newbie on Windows. I'd like to write a very simple program to stop and
restart a program [so I can update its DB] and this'd be a snap on Unix
but I can't quite get my head around it on XP.
First, starting the new version: would I do a good old fork/exec? Or
should I try to figure out how to use Win32::Process::Create? [or
something else?]
Second, how to find and kill the existing process? No "/dev/proc" to
find the existing process ID -- so how would I find it? [the task I want
to kill runs in the 'background', generally started with the "Startup"
tasks, and has a systray icon]. And once I find it, I assume it'd be best
to use Win32::Process:KillProcess rather than kill(1, $pid)?
/bernie\
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs