创建脚本文件
/etc/init.d/prs_xml.jar
添加脚本
chkconfig -add prs_xml.jar
查看服务列表
chkconfig --list
启动服务
chkconfig prs_xml.jar on
设置启动等级
chkconfig --level 35 prs_xml.jar on
#!/bin/sh #chkconfig: 2345 85 15 #description:auto_run #程序名 RUN_NAME="prs_xml.jar" #jar包位置 JAVA_OPTS=/root/xml/first-system-0.0.1-SNAPSHOT.jar #后台运行日志位置 LOG_OPTS=/root/xml/nohup.out #开始方法 start() { nohup java -jar $JAVA_OPTS >$LOG_OPTS 2>&1 & echo "$RUN_NAME started success." } #结束方法 stop() { echo "stopping $RUN_NAME ..." kill -9 `ps -ef|grep $JAVA_OPTS|grep -v grep|grep -v stop|awk '{print $2}'` } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo "Userage: $0 {start|stop|restart}" exit 1 esac
标签:xml,chkconfig,springboot,jar,重启,stop,start,注册,prs From: https://www.cnblogs.com/itniwota/p/16941106.html