vps交流

frp设置开机启动失败,咋回事呢?


frpc存放路径/frp_0.53.0_linux_arm64
直接执行/frp_0.53.0_linux_arm64/frpc -c /frp_0.53.0_linux_arm64/frpc.toml是可以正常运行的

xxx.xxx.xxx.xxx是我服务器的ip地址

然后打算做成服务来开机启动
在/etc/systemd/system创建了一个frpc.service
内容如下:

  1. [Unit]
  2. Description=frpc
  3. After=network.target      
  4. [Service]
  5. User=root
  6. Type=forking
  7. RemainAfterExit=yes
  8. ExecStart=/frp_0.53.0_linux_arm64/frpc -c /frp_0.53.0_linux_arm64/frpc.toml
  9. [Install]
  10. WantedBy=multi-user.target

复制代码

systemctl enable frpc

然后重启系统reboot,发现frpc没有正常启动。查看日志发现
root@raspberrypi:~# systemctl status frpc
● frpc.service – frpc
     Loaded: loaded (/etc/systemd/system/frpc.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2024-06-21 21:06:58 CST; 3min 46s ago
    Process: 552 ExecStart=/frp_0.53.0_linux_arm64/frpc -c /frp_0.53.0_linux_arm64/frpc.toml (code=exited, status=1/FAILURE)
        CPU: 92ms

Jun 21 21:06:57 raspberrypi systemd[1]: Starting frpc…
Jun 21 21:06:58 raspberrypi frpc[552]: 2024/06/21 21:06:58 [I] [root.go:141] start frpc service for config file [/frp_0.53.0_linux_arm64/frpc.toml]
Jun 21 21:06:58 raspberrypi frpc[552]: 2024/06/21 21:06:58 [I] [service.go:288] try to connect to server…
Jun 21 21:06:58 raspberrypi frpc[552]: 2024/06/21 21:06:58 [W] [service.go:291] connect to server error: dial tcp xxx.xxx.xxx.xxx:7000: connect: network is unreachable>
Jun 21 21:06:58 raspberrypi frpc[552]: 2024/06/21 21:06:58 [I] [root.go:159] frpc service for config file [/frp_0.53.0_linux_arm64/frpc.toml] stopped
Jun 21 21:06:58 raspberrypi frpc[552]: login to the server failed: dial tcp xxx.xxx.xxx.xxx:7000: connect: network is unreachable. With loginFailExit enabled, no additional retries will be attempted
Jun 21 21:06:58 raspberrypi systemd[1]: frpc.service: Control process exited, code=exited, status=1/FAILURE
Jun 21 21:06:58 raspberrypi systemd[1]: frpc.service: Failed with result ‘exit-code’.
Jun 21 21:06:58 raspberrypi systemd[1]: Failed to start frpc.

延迟10秒运行看看?

zutianrun 发表于 2024-6-21 21:25
延迟10秒运行看看?

大佬,怎么设置延迟?

connect to server error: dial tcp xxx.xxx.xxx.xxx:7000: connect: network is unreachable>

frps的7000端口可以连接吗

为什么不放到rc.local

一二三转身起飞~
直接docker了事。

yanzhiling2002 发表于 2024-6-21 21:41
connect to server error: dial tcp xxx.xxx.xxx.xxx:7000: connect: network is unreachable>

可以,服务器是正常的

本帖最后由 lmskk 于 2024-6-21 22:02 编辑

看错了

秋风雅居 发表于 2024-6-21 21:59
可以,服务器是正常的

可能就是网络没起来。
试试
Restart=on-failure
RestartSec=5s