Myluzh Blog

Strive to become a dream architect.

frp开机自启与进程守护

发布时间: 2020-7-29 文章作者: myluzh 分类名称: NOTE


Windows
保存成run.bat放到frp运行目录即可,并且把frp.bat设为开机启动
@echo off
if "%1"=="h" goto begin
start mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
:begin

:loop
ping -n 5 127.0.0.1
tasklist|find /i "frpc.exe"
if %errorlevel% NEQ 0 (
start "" "frpc.exe" -c frpc.ini
)
goto :loop

Linux

使用systemd配置开机自启,适用于 centos7 Ubuntu 16 或 debian 8。
vi /etc/systemd/system/frps.service 新建此文件,并写入以下内容:
[Unit]
Description=frps daemon
After=syslog.target network.target
Wants=network.target
[Service]
Type=simple
ExecStart=/root/frp_0.13.0_linux_amd64/frps -c /root/frp_0.13.0_linux_amd64/frps_my.ini
Restart= always
RestartSec=1min
[Install]
WantedBy=multi-user.target
启动并设为开机自启。
systemctl start frps //启动 
systemctl status frps //状态查询 
systemctl enable frps //开机启动

标签: frp 内网穿透

发表评论