1. Write a simple Java program public class testshell { public static void main(String[] args) { int count = 0; for (String arg : args) { System.out.println("The " + (++count) + " parameter: " + arg); } } } Package the above program into centOS6 2. Write a shell script #!/bin/bash export JAVA_HOME=/usr/local/jdk1.8.0_91 export PATH=$JAVA_HOME/bin:$PATH A=`date` java -cp /root/Desktop/testshell.jar com.testshell "$A" >>/root/Desktop/c.txt Here, please note that the absolute path address of the jar package in the Java environment variable is written 3. Edit the timer file (crontab -e) Summarize The above is the script that I introduced to you in centOS6 using crontab to regularly run and execute jar programs. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: MySQL 8.0.15 installation and configuration method graphic tutorial (Windows 10 X64)
>>: Vue's new partner TypeScript quick start practice record
Table of contents 1 The common rules for creating...
The function has been implemented a long time ago...
I encountered a pitfall when writing dynamic form...
Table of contents 1. What is Promise 2. Basic usa...
1. The window size opened by the HTML hyperlink C...
1. Download the MySQL jdbc driver (mysql-connecto...
1. System Configuration 1. Turn off sudo password...
When we check the source code of many websites, w...
In most application scenarios, we need to back up...
Today, the company's springboot project is re...
Table of contents 1. Ant Design Vue 1. Official w...
I. Introduction Docker technology is very popular...
Table of contents Overview Defining filters Use o...
The official document states: By injecting the ro...
Background In Docker, four containers are created...