debian 开机启动
1.执行以下命令创建一个新的服务文件
vim /etc/systemd/system/xxx.service
2.添加以下内容
[Unit]
Description=xxx Service
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/java -jar /home/FinanceJava/xx.jar
WorkingDirectory=/xx/xx/
Restart=always
User=root
[Install]
WantedBy=multi-user.target
3.重新加载 systemd 并启用服务
systemctl daemon-reload
systemctl enable xxx
systemctl start xxx
4.查看运行状态
systemctl status xxx
取消开机启动
systemctl disable xxx
浙公网安备 33010602011771号