Try writing it as a service using Win32::Daemon (http://www.roth.net/perl), 
then using Windows' auto-restart functionality. If it runs in a service context 
it won't be killable in Task Manager anyway (although the TerminateProcess API 
still works so pskill.exe from sysinternals and other similar goodies will 
still work).

Takes a bit of effort to get right, especially since you can't see a console so 
debugging is hard, and God help you if you try services with threads, although 
I've made it work successfully here. Assuming you have a daemon type process, 
worth a look.

P.
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: 03 December 2004 20:46
To: Perl-Win32
Cc: [EMAIL PROTECTED]
Subject: Win32 process auto-restart on error/crash or kill

Hi all,

how do i automatically get a script to restart itself on error/crash or kill?

I tried $SIG{INT}, but that only works with Ctrl-C, in a console.

Lets say i were to kill the process using the Task Manager ("end process"). How
do I get the script to automatically restart?


Thanks in advance for all your help.

Jeremy A.



_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



*****************************************************************
Gloucester Research Limited believes the information 
provided herein is reliable. While every care has been 
taken to ensure accuracy, the information is furnished 
to the recipients with no warranty as to the completeness 
and accuracy of its contents and on condition that any 
errors or omissions shall not be made the basis for any 
claim, demand or cause for action.
*****************************************************************


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to