[Linux]crontab Command Execution issue

Source: Internet
Author: User

The crontab task of an R script is set on the server and is not executed. Search on the internet for a long time, finally solved.

Here is the main talk about crontab anomalies, how to troubleshoot.

Suppose the cron command is: * * * * RSCRIPT/YOUR_PATH/HELLO_WORLD.R >>/your_path/hello_world.log

1. First check that the cron command is completely correct.

Although it is very simple, but I still eat a lot of pain here.

The specific symptom is that Cron does not execute, and the execution record cannot be found under the crontab execution log.

Contab's execution log is in/var/log/cron.log (Ubunutu), and after VI is used to jump to the last line, you can see the latest execution record.

If you do not see the cron command, it is likely that the command or command path is incorrect. Check it carefully.

Note: No MTA installed, discarding output this information, the rationale and execution script is irrelevant. Can not be ignored.

(Crontab executes the script is not directly wrong information output, but will be sent to your mailbox in the form of mail, this time you need a mail server, if you do not install the mail server, it will report this error)

2.crontab Environment Configuration Issues

You should consider this when you can execute it manually in the shell, but you cannot execute it in crontab.

This time in the cron log you can see the execution record of the cron command, but the script is not executed. There is no information under the Hello_world.log.

There is a lot of content, that is, the problem of environment configuration (it should also be the problem of environment configuration). The simple thing is that the environment in which Crontab executes is inconsistent with our own environment when executing in the shell.

More detailed information can be found here: http://blog.csdn.net/zc02051126/article/details/20480289

Although the link said a lot of solutions, but I do not know what he is talking about, hehe.

I directly specified the absolute path of the command and changed the cron command to: * * * * /usr/local/bin/rscript/your_path/hello_world.r >>/your_path/ Hello_world.log

Edit Crontab again, finally found the output information in the Hello_world.log.

* Absolute paths vary depending on the location of your installation program. Common have/usr/bin,/usr/local/bin and so on. If unsure, go to the path under LS to see if there is a corresponding program.

* Online Many say the first line in the script plus the environment path (such as #!/usr/bin). But I think this should have nothing to do with scripting other languages outside of the shell script.

crontab Command Guide, you can refer to: http://www.cnblogs.com/peida/archive/2013/01/08/2850483.html Although I still do not understand, hehe.

[Linux]crontab Command Execution issue

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.