1. First, write your java quartz job, and then use the Eclipse export it into runnable jar
2. Write shell scripts
#!/bin/sh # chkconfig: 23456 80 10 # description: check pnr export SERVER=/usr/job/ cd $SERVER case "$1" in start) nohup java -server -jar ZeusService.jar zeus.quartz.air.XePnrTrigger -Xms128m -Xmx1024m & echo $! > $SERVER/server.pid ;; stop) kill `cat $SERVER/server.pid` rm -rf $SERVER/server.pid ;; restart) $0 stop sleep 1 $0 start ;; *) echo "Usage: run.sh {start|stop|restart}" ;; esac exit 0
3. Publishing Service
1) The SH script file ZeusService put to the etc / init.d
2) to put at the ZeusService.jar usr / job directory
3) executing a statement
chkconfig --add ZeusService // add registration
cd /etc/init.d // Jump directory
dos2unix ZeusService // file format conversion (optional)
chmod 777 ZeusService // Authorization
service ZeusService start // Start Service
ps aux | grep ZeusService // check if the service starts
Reproduced in: https: //www.cnblogs.com/davidgu/archive/2013/03/29/2988578.html