我这边是frp开机启动每次都失败,需要手动重启
错误代码
2022/07/04 15:58:16 [W] [service.go:128] >
7月 04 15:58:16 innovation frpc[717]: dial tcp 81.68.87.95:7000: connect: netwo>
7月 04 15:58:16 innovation systemd[1]: frpc.service: Main process exited, code=>
7月 04 15:58:16 innovation systemd[1]: frpc.service: Failed with result 'exit-c>
~
解决办法: 设置,在服务启动失败后重试
1. 新建一个service文件
sudo vim /etc/systemd/system/frpc.service
2.写入要重启的内容
[Unit]
Description=Frp Client Service
After=network.target
[Service]
Type=simple
User=nobody
# 失败后重启
Restart=on-failure
# 每5秒试一次
RestartSec=5s
# 启动时执行的命令
ExecStart=/root/frp/frpc -c /root/frp/frpc.ini
# 重启时执行的命令
ExecReload=/root/frp/frpc reload -c /root/frp/frpc/frpc.ini
[Install]
WantedBy=multi-user.target
3. 启动服务
# 启动
systemctl start frpc
# 配置开机自启
systemctl enable frpc