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 内容如下:
- [Unit]
- Description=frpc
- After=network.target
-
- [Service]
- User=root
- Type=forking
- RemainAfterExit=yes
- ExecStart=/frp_0.53.0_linux_arm64/frpc -c /frp_0.53.0_linux_arm64/frpc.toml
-
- [Install]
- 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.
|