Can I limit the runtime of a cronjob
I've got a cronjob which runs hourly that is occasionally taking too long to run, is there any way I can set a maximum runtime and the job gets killed if it exceeds that?
This is on an Ubuntu 10.04 server.
Thanks, jebw
Solution 1:
Try the timeout
command. For example:
0 * * * * timeout -2 3540 /path/to/your_command.sh
will send a SIGINT to your command if it hasn't completed in 59 minutes.