[TriLUG] Starting and stopping jobs with cron

Victor Snesarev vnsnes at yahoo.com
Thu Dec 9 19:33:13 EST 2004


Here's the situation... I start a process using cron, but I need to kill 
that process one hour later using cron. There doesn't seem to be a 
crontab option to run a command for a specified period of time. I 
suppose I could set an environment variable at the start of the process 
containing the process ID and an hour later use that environment 
variable as an argument to "kill", but I do not know a way to retrieve 
the process ID.

Would it be easy to parse "ps | grep <command_name>" or is there an 
better way to do this?

Any suggestions?

TIA,
Victor



More information about the TriLUG mailing list