in reply to Kill a script at a certain time
If your script is named script.pl, you can put something like the following in your crontab:
(I couldn't help but slip some Perl in there ;-)00 16 * * * kill `ps -auxww | grep script.pl | grep -v grep | perl -an +e 'print "$F[1] "'`
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 script.pl 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!
|
---|
In Section
Seekers of Perl Wisdom