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