Scripts for executing Java programs in crontab

Source: Internet
Author: User

Test Scenario Description (Operating system: CENTOS7):

There is a bash script that executes a Java program, which is a script that/data/project1/start.sh

CRONTAB-E, added the following tasks:

0   1  * * * *  /data/project1/start.  SH

This configuration sets the 1-point execution/data/project1/start per day. sh, start.sh in the end is similar to executing Java programs like this:

/usr/java/jdk1.8.0_71/bin/java-classpath "/data/project1/lib/xxx.jar:/data/project1/lib/xxx.jar:.." MainClass

However, the Java program has not been successfully executed.

After a lot of review forum posts and repeated attempts to finally find a solution. The crontab needs to be configured as follows:

0   1  *  *  sh ./start.  SH &)

Note: All paths used in start.sh, such as Java,jar, directories, etc., need to use absolute paths

Scripts for executing Java programs in crontab

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.