FRP注册为systemd服务
把 frps 或 frpc 注册成 systemd 服务后,启动、重启和开机自启都会顺很多。
frps 示例
[Unit]
Description = frp https for server
After = network.target syslog.target
Wants = network.target
[Service]
Type = simple
ExecStart = /root/frp/frp_0.62.1_linux_amd64/frps -c /root/frp/frp_0.62.1_linux_amd64/frps.toml
[Install]
WantedBy = multi-user.targetfrpc 示例
[Unit]
Description = frp https for client
After = network.target syslog.target
Wants = network.target
[Service]
Type = simple
ExecStart = /root/frp/frp_0.62.1_linux_amd64/frpc -c /root/frp/frp_0.62.1_linux_amd64/frpc.toml
[Install]
WantedBy = multi-user.target常用操作
sudo systemctl daemon-reload
sudo systemctl enable frps --now
sudo systemctl enable frpc --now
sudo systemctl status frps
sudo systemctl status frpc注意
真正使用时,需要把 ExecStart 改成实际的 FRP 安装路径和配置文件路径。