springboot项目jar包位置:Desktop/cas-back/target/sso-1.0.0-SNAPSHOT.jar
简易脚本如下:sso.sh
#!/bin/sh
#chkconfig: 2345 80 90
#description:开机自动启动的脚本程序
# 开启
cd /etc/rc.d/init.d
nohup /usr/java/jdk1.8.0_171/bin/java -jar -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xms1024m -Xmx4g -Xmn256m -Xss256k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC Desktop/cas-back/target/sso-1.0.0-SNAPSHOT.jar &
将脚本sso.sh放置在linux下的/etc/rc.d/init.d路径下
vim /etc/rc.d/rc.local
在rc.local文件下加入
/bin/sg /etc/rc.d/init.d/sso.sh
如下所示:
chmod +x /etc/rc.d/rc.local
reboot你懂得