Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I want to write a short perl program that checks to make sure the program hasn't stopped. Since it writes to a several times a second (when working), I thought I could check the time of the file every second (with "sleep 1"), and if it differed from the current time by more than a second, kill the program and restart it.
Does the idea sound reasonable or does someone know a completely different (better) approach? I assume I would use "exec" (and not "system") to start the program. Does some easy way exist to get the process number to kill it? Any other pitfalls to avoid?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Keeping a program running
by graff (Chancellor) on May 09, 2007 at 05:17 UTC | |
by Anonymous Monk on May 09, 2007 at 06:07 UTC | |
by graff (Chancellor) on May 09, 2007 at 18:44 UTC | |
|
Re: Keeping a program running
by chrism01 (Friar) on May 09, 2007 at 07:09 UTC |