1.运行
nohup ./frps -c frps.ini >/dev/null 2>&1 &
或者客户端:
nohup ./frpc -c ./frpc.ini >/dev/null 2>&1 &
2.停止
先找到这个进程
ps -aux|grep frp| grep -v grep
root 3600 0.1 0.1 110188 9484 pts/0 Sl 15:04 0:00 ./frpc -c ./frpc.ini
执行之后如果显示这样则成功了
然后kill -9 进程号
kill -9 3600
3.操作系统 Ubuntu, 目的是让我的 frp 后台启动,同时能自启动,毕竟服务器那边常常维护重启啥的
- 登录服务器,
- 到你安装 frps 的目录下 输入pwd 可以得到你的安装目录
- 输入
sudo vim /lib/systemd/system/frps.service
其实就是在 root/lib/systemd/system 下面新建一个文件frps.service -
在文件里面写入以下内容
[Unit]
Description=frps daemon
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=ltpc
#此处把/root/frp_linux_arm64替换成 你的frps的实际安装目录
ExecStart=/root/frp_linux_arm64/frps -c /root/frp_linux_arm64/frps.ini[Install]
WantedBy=multi-user.target -
有几点需要注意,为了使服务能够自动无限次重启,需要增加以下几个配置
StartLimitIntervalSec=0 Restart=always RestartSec=1
- 然后就启动frps
sudo systemctl start frps
- 再打开自启动
sudo systemctl enable frps
-
其他
- 重启应用
sudo systemctl restart frps
- 停止应用
sudo systemctl stop frps
- 查看日志
sudo systemctl status frps
- ./frpc -v #显示版本号
- 重启应用
评论