http://qs321.pair.com?node_id=603984


in reply to Auto-restarting script if it dies

-e doesn't need you to open and read the contents of the file. It's purpose is to test for the existence of a file, like this:

if (-e $checkme) { print "woo hoo\n"; }

And what about the script that checks check_if_its_running.pl is still running?

Here's a meta solution ;-)

for (my $i = 2 to MAX_INTEGER) { if (-e "$checkme.$i") { print "woo hoo\n"; } else { start_it($i); } }