Linux system crontab shell script to execute JAR package __crontab

Source: Internet
Author: User
 

-CP and-classpath Specify the paths of other classes that the class runs on, usually the class library, the jar pack, and so on

Windows semicolon ";" separated by semicolons on Linux: "Delimited." Use a little "." Represents the current path (instance not applied)

/usr/java/jdk1.6.0_18/bin  is $java_home  JDK directory   written separately JAVA-CP can also be executed


Instance:

#!/bin/sh
export lang= "ZH_CN. GB18030 "
path= $PATH: $HOME/bin
db2insthome=/home/db2inst/sqllib
export db2insthome
if [F $ Db2insthome/db2profile]; Then
    . $DB 2insthome/db2profile
fi

export PATH
echo ' Start---do '
/usr/java/jdk1.6.0_18/bin /java  -dfile.encoding=gbk-cp/home/testftp/temp_0802/log4j-1.2.11.jar:/home/testftp/temp_0802/monitor1.jar Com.cn.test.Testtwo
echo '---the--end--'


The shell script finally specifies the Main method entry: Package name + class name



Last Crontab-e

5/* * * * */opt/ripamonitor.sh >>/opt/ripamonitor.log

Execute every 5 minutes

Related Article

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.