I used the following command in crontab to execute these three commands in a a row every week:
0 0 * * 6 docker export dfdf > backup.tar && python gdrive-upload/upload.py -i backup.tar -o $(date +"%Y-%m-%d-%I-%M-%p")-backup.tar -f backup && rm backup.tar
However, syslog shows the following:
Feb 25 17:36:30 xxx cron[3314]: Error: bad hour; while reading crontab for user root
Feb 25 17:36:30 xxx cron[3314]: (root) ERROR (Syntax error, this crontab file will be ignored)
The problem should be on the second command as I tried with first && third only and works fine.
python gdrive-upload/upload.py -i backup.tar -o backup.tar -f backup
I wonder why the command syntax is wrong (besides the %)? I have tried it in the command line and it works fine.
I am using ubuntu. Previously the crontab
does not work so I deleted /etc/environment
file.
Any help will be appreciated. Thanks.