少于 1 分钟阅读

#可以跳过这一步
systemctl enable sshd 

sudo vim /usr/lib/systemd/system/rc-local.service

#输入
[Unit]
Description="/etc/rc.local Compatibility"
#Wants=sshdgenkeys.service
#After=sshdgenkeys.service
#After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardInput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

#执行
sudo touch /etc/rc.local
sudo chmod +x /etc/rc.local

sudo vim /etc/rc.local
sudo systemctl enable rc-local.service

FROM https://www.jianshu.com/p/7fbafa98caf4

  • 还有一个无敌的,但是要对服务进程特别熟悉

启动服务

cd /etc/systemd/system/
vim clash.service
sudo systemctl daemon-reload
sudo systemctl enable clash.service
sudo systemctl start clash.service

停止服务

sudo systemctl stop clash.service
sudo systemctl disable clash.service
sudo systemctl deamon-reload
sudo systemctl status clash.service