in reply to Process Reliablity
If you really care about your process you'll back this up with some of the methods mentioned above. You may also want to put some checks on to keep the process from thrashing (constantly restarting the process, which immediately dies again, etc...) just in case. This technique does have the nice side-effect that the restarts are nearly instentaneous.#!/usr/bin/perl -w use strict; launch_child(); $SIG{CHLD}=\&launch_child; sleep 60 while(1); sub launch_child{ print "$$ parent spawning a child\n"; my $pid=fork; if(!$pid){ print "$$ inside the child\n"; # all the code that does the real work is in here # all the other stuff is just a wrapper to keep # this bit going sleep 60 while(1); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Process Reliablity
by DrManhattan (Chaplain) on Jul 20, 2000 at 18:40 UTC | |
by lhoward (Vicar) on Jul 20, 2000 at 18:46 UTC |