2019年4月6日 15:21
- 准备好脚本,脚本本身可以是阻塞的,这时,在运行时,系统能检测得到
- 编写服务文件:
sudo vim /etc/systemd/system/frpc.service
[Unit]
After=network.target
ConditionPathExists=/home/zhmt/mydisk/study/prog/frp/run.sh
[Service]
User=zhmt
Type=simple
Restart=on-failure
ExecStartPre=/bin/sleep 5
ExecStart=/home/zhmt/mydisk/study/prog/frp/run.sh
[Install]
WantedBy=multi-user.target
- 自启动服务
sudo systemctl enable frpc.service
sudo systemctl start frpc.service