Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Auto-restarting script if it dies

by mojodaddy (Pilgrim)
on Mar 09, 2007 at 20:37 UTC ( #604046=note: print w/replies, xml ) Need Help??


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

Wow... You'll have to forgive me for being a little star-struck here. I'm both hideously embarrassed and oddly proud to know that you've read and responded to my humble code. (But mostly the former.) Thanks, merlyn.
  • Comment on Re^2: Auto-restarting script if it dies

Replies are listed 'Best First'.
Re^3: Auto-restarting script if it dies
by ant (Scribe) on Mar 12, 2007 at 12:35 UTC
    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
      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://604046]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2021-01-24 01:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?