Reasons for crontab execution failure in CentOS

Source: Internet
Author: User

1 crond service not started

Crontab is not a Linux kernel function, but depends on a crond service, which can be started or stopped. If you stop the task, you cannot execute any scheduled task. The solution is to open it:

Crond

Or

Service crond start

If the crond command does not exist, it may be deleted by mistake. In CentOS, You can reinstall the command:

Yum-y install crontabs

2. Permission issues

For example, the script does not have the x execution permission. solution:

Add execution permission or execute the command using bash abc. sh.

3. Path Problems

Some commands run normally in shell, but they always fail to be executed in crontab. It may be because the sh used by crontab does not recognize the path correctly. For example, if you log on to the shell as a root and run a/root/test. sh command

./Test. sh

You can. However, the script cannot be found in crontab. For example, the script is complete:

/Root/test. sh

4. Time Difference

Because of the time difference between the server and the client, the crontab time is based on the server time.

5 variable problems

Sometimes the command contains variables, but the crontab does not exist during execution, and the execution may fail.

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.