I have a scheduled cron job (which is actually a shell script). I'd like to limit the script execution time as it can work unacceptably long. For some reason I can not limit the script execution time from inside the script. Actually, I want my system to force the task termination if it runs more than N hours. Please advise.
I'm responding by myself just because none answered.
0 * * * * timeout -s 9 3540 /path/to/your_command.sh
will send a SIGINT to your command if it hasn't completed in 59 minutes.