Sometimes tasks in crontab cannot be executed. check the following points: 1. absolute path. Whether directly writing commands or executing scripts in cron, if it is a script, the absolute path also needs to be written in the script. 2. the script is executable. You have the x permission of the user running cron. 3. after crontab-e is used, you can see one under/var/spool/cron /.
Sometimes tasks in crontab cannot be executed. check the following points:
1. absolute path. Whether directly writing commands or executing scripts in cron, if it is a script, the absolute path also needs to be written in the script.
2. the script is executable. You have the x permission of the user running cron.
3. after crontab-e is used, you can see a file with the same name as the user name under/var/spool/cron/(if it is unix, this file is located under/var/spool/cron/crontabs). Otherwise, it must be your crontab error.
4. others.
In other cases, check the email to confirm:
1. $ mail
2. open the email related to the crontab error.
3. View error information
P.S. the source is: no matter what the execution is like after the time, there will be a file with the same user name under/var/mail, which is the execution result.
If an error message is:
/Usr/bin/MysqlDump-u redmine-predmine redmine | gzip>/home/redmine-backup/db/redmine _ 'date +
Date: Mon, 13 Jun 2011 23:00:01 + 0800 (CST)
/Bin/sh: Syntax error: EOF in backquote substitution
For example:
/Usr/bin/mysqldump-u redmine-predmine redmine | gzip>/home/redmine-backup/db/redmine _ $ (date/+
Date: Thu, 23 Jun 2011 17:13:01 + 0800 (CST)
/Bin/sh: Syntax error: end of file unexpected (expecting ")")
The wrong crontab command line looks a little strange when writing, and it turns red after % y
/Usr/bin/mysqldump-u redmine-predmine redmine | gzip>/home/redmine-backup/db/redmine _ 'date ready y-ready m-ready d'.gz
-->
0 23 ** 1-5/usr/bin/mysqldump-u redmine-predmine redmine | gzip>/home/redmine-backup/db/redmine-'date +/% y-/% m-/mongod'.gz
% Escape must be canceled before/in shell.