linux(Ubuntu) Frp后台自动启动的方法
背景提要
操作系统 Ubuntu, 目的是让我的 frp 后台启动不妨碍我干其他事,同时能自启动,毕竟服务器那边常常维护重启啥的。
步骤
-
登录服务器,输入
sudo vim /lib/systemd/system/frps.service
其实就是在 root/lib/systemd/system 下面新建一个文件frps.service
-
在文件里面写入以下内容
[Unit]
Description=frps daemon
[Service]
Type=simple
#此处把/root/frp_linux_arm64替换成 你的frps的实际安装目录
ExecStart=/root/frp_linux_arm64/frps -c /root/frp_linux_arm64/frps.ini
[Install]
WantedBy=multi-user.target
你的安装目录可以这样得到,到你安装 frps 的目录下 输入pwd
- 然后就启动frps
sudo systemctl start frps
- 再打开自启动
sudo systemctl enable frps
搞定收工
其他
- 重启应用
sudo systemctl restart frps
- 停止应用
sudo systemctl stop frps
- 查看日志
sudo systemctl status frps
参考文献
https://github.com/fatedier/frp/issues/176
https://gist.github.com/ihipop/4dc607caef7c874209521b10d18e35af