Linux under Crontab timed Java program execution, Java program does not perform the problem

Source: Internet
Author: User

The syntax of crontab

in each of these fields, you can also use the following special characters :

asterisk (*): represents all possible values, such as the month field if it is an asterisk, the command action is executed monthly after the constraints of other fields are met.
comma (,): You can specify a list range with a comma-separated value, for example, "1,2,5,7,8,9"
Middle Bar (-): An integer range can be represented by a middle bar between integers, such as "2-6" for "2,3,4,5,6"

Forward slash (/): You can specify the interval frequency of the time with a forward slash, such as "0-23/2", which is performed every two hours. A forward slash can be used with asterisks, such as */10, if used in the minute field, which means that it executes every 10 minutes.


Here are some of the timing tasks I have encountered:

The first is also crontab-e as follows:

0 6 * * */data/ftp/ftp001/my/sh/cac.sh >/data/ftp/ftp001/qiangzhan/sh/log/cac.log, will be automatically executed, no problem.


/data/ftp/ftp001/my/sh/cac.sh in the cac.sh implementation is the Java program, vi cac.sh content as follows: JAVA-XMS2048M-XMX4096M-CP.: Mysql-connector-java-5.1.26-bin.jar:data.jar Cmge. Appmain 2015/01/02. Running cac.sh alone is OK, but the Java program is not run with crontab execution.

READ: crontab Unable to get JDK variables, to write to the JDK absolute path before the Java command, and to switch to the SH path to be executed, I this problem these two conditions are indispensable. Modify the cac.sh to:

cd/data/ftp/ftp001/my/sh/

/usr/lib/jvm/jdk1.7.0_71/bin/ java-xms2048m-xmx4096m-cp.: Mysql-connector-java-5.1.26-bin.jar:data.jar cmge. Appmain 2015/01/02




Linux under Crontab timed Java program execution, Java program does not perform the problem

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.