I am trying to make a cron entry for a shell script:
50 */4 * * * /path/script-file.sh > /dev/null 2>&1
aims to run a script on HH: 50 with a frequency of 4 hours. But this is a mistake with the message:
crontab: error in the previous line; unexpected character found in string.crontab: input errors detected, crontab file not created.
crontab: error in the previous line; unexpected character found in string.
crontab: input errors detected, crontab file not created.
I deleted "/ 4" and the error went away, but I know cron allows this format. Does anyone know what the problem is?
Thanks so much for any help.
Some implementations crondo not support steps (for example */4) - check man 5 crontabon your specific system.
cron
*/4
man 5 crontab
You can use a list instead 0,4,8,12,16,20.
0,4,8,12,16,20
Off-topic: bash, , , > /dev/null 2>&1 &>/dev/null stdout stderr 1>&- 2>&-. (. @Keith )
> /dev/null 2>&1
&>/dev/null
1>&- 2>&-