vi /etc/systemd/system/frps.service 新建此文件,并写入以下内容
frpc:
[Unit]
Description=frpc daemon
After=syslog.target network.target
Wants=network.target
[Service]
Type=simple
ExecStart=/root/frp/frpc -c /root/frp/frpc.ini
Restart= always
RestartSec=1min
[Install]
WantedBy=multi-user.target
frps服务端
[Unit]
Description=frps daemon
After=syslog.target network.target
Wants=network.target
[Service]
Type=simple
ExecStart=/root/frp/frps -c /root/frp/frps.ini
Restart= always
RestartSec=1min
[Install]
WantedBy=multi-user.target
启动 FRP 并设置开机启动
$ sudo systemctl enable frps
$ sudo systemctl start frps
$ sudo systemctl status frps
CENTOS7的命令为:
使用启用/禁用服务来控制开机启动
你也可以使用enable/disable选项来控制一个服务是否开机启动,命令如下:
# systemctl enable frpc.service
# systemctl disable frpc.service
要启动一个服务,你需要使用如下命令:
# systemctl start frpc.service 启动服务
# systemctl status frpc.service 查看状态
# systemctl restart frpc.service 重启服务
# systemctl try-restart frpc.service
# systemctl reload frpc.service 重载配置文件