Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Auto-restarting script if it dies

by ant (Scribe)
on Mar 12, 2007 at 12:35 UTC ( [id://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

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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://604332]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2024-03-28 14:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found