my $fork_period = 30*60; # 30 minutes my $forktime = time + $forkperiod; while (1) { # Do my happy processing. # This must loop periodically (at most once a minute) # otherwise you may badly miss your forktime and get # killed. # We don't want to fork too often (or they might think # we are a runway and kill us). if (time > $forktime) { # Kill the parent exit if fork(); $forktime = time + $forkperiod; } }