cron job timing

Solution 1:

I think something along the lines of:

30/5 9-16 * * *  /usr/bin/script_to_run.sh

See the wiki page for details of timing syntax. I suggest testing this with a script that logs the time it runs at to a file.

#!/bin/bash

echo "Cron ran at: " `date` >> /var/log/crontimetest.log

Solution 2:

you'll need three crontab entries:

30-55/5 9 * * * /usr/bin/script-to-run.sh
*/5 10-15 * * * /usr/bin/script-to-run.sh
0-30/5 16 * * * /usr/bin/script-to-run.sh

please do not blame linux, or bsd, or me, for the bizarre and useless syntax of crontab entries. this was invented at AT&T Bell Labs, and later standardized as part of POSIX.