Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Kill a script at a certain time

by Starky (Chaplain)
on Feb 18, 2003 at 20:41 UTC ( #236390=note: print w/ replies, xml ) Need Help??

in reply to Kill a script at a certain time

If your script is named, you can put something like the following in your crontab:

00 16 * * * kill `ps -auxww | grep | grep -v grep | perl -an +e 'print "$F[1] "'`
(I couldn't help but slip some Perl in there ;-)

Obviously, you may need to customize it to whatever environment you're using (e.g., `ps -ef` if you are using HP-UX etc.) and whatever other contingencies you may anticipate (e.g., you'll note that in its current incarnation, if file appears in the argument list of the call to your editor, your editor will be killed as well every afternoon at 4:00pm). But that's the basic idea.

Hope this helps!

Comment on Re: Kill a script at a certain time
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2015-11-28 04:12 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (737 votes), past polls