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

上一篇:jar包服务配置服务和自启动


下一篇:Google Earth Engine——全球地表覆盖分类(城市、植被、水体)案例分析(超500行代码!)