系统相关
首页 > 系统相关> > linux设置jar服务开机启动

linux设置jar服务开机启动

作者:互联网

1.编辑earth.service

[Unit]
Description=earth
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=simple
User=root
WorkingDirectory=/home/ross/earth
ExecStart=/home/ross/jdk1.8.0_251/bin/java -jar /home/ross/earth/earth-0.0.1-SNAPSHOT.jar &

[Install]
WantedBy=multi-user.target

2. 放到/usr/lib/systemd/system

3. 执行chmod 775 earth.service

4. 执行systemctl daemon-reload

5. 启动systemctl start earth.service

6. 设置开机启动systemctl enable earth.service

标签:target,service,jar,systemctl,linux,开机,earth,ross
来源: https://www.cnblogs.com/anenyang/p/15254289.html