Solution to Linuxcron not executing tasks

Source: Internet
Author: User
Tags redmine
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.