暗暗查查

没有谁会为你踏雪而来,喜欢的风景要躬亲筚路。人生有什么意义,接受赠予+22181803

  博客园  :: 首页  :: 新随笔  :: 联系 ::  :: 管理
vi /etc/systemd/system/xxx.service
[Unit]
Description=My Screen Session
After=network.target
 
[Service]
Type=forking
ExecStart=/usr/bin/screen -dmS mysession /bin/bash -c 'your_command_here'
ExecStop=/usr/bin/screen -S mysession -X quit
Restart=on-failure
 
[Install]
WantedBy=multi-user.target
your_command_here 输入你自己要执行的命令
sudo systemctl daemon-reload

sudo systemctl enable xxx.service

设置成功与否

sudo systemctl is-enabled xxx.service

手动开启下:

systemctl strat xxx

查看状态

systemctl status xxx

 

posted on 2025-03-11 10:51  长虫山小木屋  阅读(134)  评论(0)    收藏  举报