[TriLUG] Starting and stopping jobs with cron

Jeff Groves jgroves at krenim.org
Thu Dec 9 19:47:32 EST 2004


PID is available in the system variable: $$

Thanks,

Jeff G.
Victor Snesarev wrote:
> 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