Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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 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 script, first time in the loop, file does not exist, starts and creates checkme.txt and then the checker script continues checking checkme.txt.

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

  • 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?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2023-09-30 23:51 GMT
Find Nodes?
    Voting Booth?

    No recent polls found