Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Restarting perl script by itself

by ChuckularOne (Parson)
on Sep 16, 2011 at 17:48 UTC ( #926453=note: print w/ replies, xml ) Need Help??


in reply to Restarting perl script by itself

I have recently done something similar, but I decided to let cron do the killing.

My process starts by creating a kill script and then cron executes it once a day and then spawns a new instance of the main script which creates a new kill script and it gets a little like groundhog day.

### Create the kill script for cron ### my $killPid = $$; bifFile::writeToFile($killscript, "kill $killPid"); my $mode = '0755'; chmod oct($mode), $killscript;
$killscript is the path and name of the script (a ksh script in this case) and bifFile is a perl module full of silly little utilities I use all the time. writeToFile uses two parameters, filename and text to put in the file.


Comment on Re: Restarting perl script by itself
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2015-07-06 00:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls