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

posted on 2025-03-05 14:26  yaolunhui  阅读(62)  评论(0)    收藏  举报

导航