#!/usr/bin/perl use strict; # Loop indefinitely while (1) { # Fork off a child process my $kidpid = fork(); if ($kidpid) { # This is the parent process. Wait for # the child to exit waitpid($kidpid, 0); # Put some code here to send you an alert # when the child dies. You can also # check the child's exit condition here # with $?. } elsif (defined($kidpid)) { # This is the child process. # Put your original script in here # or just use exec() } else { die "could not fork"; } }
That will fork off a child process to handle your script and restart it every time it dies
-Matt
In reply to RE: Process Reliablity
by DrManhattan
in thread Process Reliablity
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |