Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Auto-restarting script if it dies

by ant (Scribe)
on Mar 12, 2007 at 12:35 UTC ( #604332=note: print w/replies, xml ) Need Help??


in reply to Re^2: Auto-restarting script if it dies
in thread Auto-restarting script if it dies

This could be just me, but it seems a bit odd to start one script, and then start another script to check the first script.

Perhaps you could in the checker.pl delete the checkme.txt file (under the line where you declare var $checkme, that way, on start up it's deleted and does not pick up an old version of the file with an old temp file name, as checkme.txt is never deleted any where in your code)

Run the checker.pl script, first time in the loop, file does not exist, starts always_running.pl and creates checkme.txt and then the checker script continues checking checkme.txt.

Just trying to refine the process, I liked the idea lots.

Ant
  • Comment on Re^3: Auto-restarting script if it dies

Replies are listed 'Best First'.
Re^4: Auto-restarting script if it dies
by mojodaddy (Pilgrim) on Mar 13, 2007 at 16:42 UTC
    No, checkme.txt is never deleted; it gets overwritten each time the script starts, though, so the scenario you described never occurs.

    The thing's been working great, too -- almost too well! It was pretty hilarious the first couple of times I tried to restart the script because I'd made a change to the code. It just kept popping back up again! It was like playing whack-a-mole. I've since concluded that stopping the checker first and then stopping the script is the preferred technique!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://604332]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2021-01-26 19:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?