Reputation: 55
I have been trying to make a cron entry for a shell script:
50 */4 * * * /path/script-file.sh > /dev/null 2>&1
aimed to run the script at HH:50 at a frequency of 4 hours. But this errors out with the message:
crontab: error on previous line; unexpected character found in line.
crontab: errors detected in input, no crontab file generated.
I removed the "/4" and the error vanished, but I know that cron does allow this format. Does anybody know what the issue could be?
Thank you very much for any help.
Upvotes: 3
Views: 8786
Reputation: 887
Some cron
implementations don't support steps (e.g. */4
) - check man 5 crontab
on your particular system.
You can use the list 0,4,8,12,16,20
instead.
Off-topic: If you are using bash, you could probably replace (see @Keith Thompson's comment below)> /dev/null 2>&1
with the shorter &>/dev/null
or just close stdout and stderr with 1>&- 2>&-
.
Upvotes: 3