进入 /etc/systemd/system 目录下
新建 veggie.service
[Unit]
Description=wechat
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/opt/java/jdk1.8.0_191/bin/java -jar /opt/proj/noblem-veggie-0.0.1-SNAPSHOT.jar
ExecStop=/bin/kill -15 $MAINPID
User=root
Group=root
[Install]
WantedBy=multi-user.target
systemctl start demo.service 启动服务
systemctl enable 开机自启动
systemctl disable 停止开机自启动
systemctl status 查看状态
systemctl restart 重启服务