注意下面/root位置都要改成文件存放位置;
记得加权限。
frpc配置文件在etc/storage/frpc/frpc.ini 新建,
npc可以vkey启动,也可以读取/etc/storage/npc/npc.conf 配置文件启动
开机自启动:
Padavan,可以放到脚本-WAN启动后,或防火墙启动后;
sh /media/AiDisk_a1/frpc/frpcstart.sh
OpenWrt的自启动参考这里
frp启动代码
-------------------------------------frpcstart.sh--------------------------------------
#!/bin/sh
cd /root
sh frpcstop.sh
sleep 1
./frpc-watchdog >/dev/null 2>&1 &
echo "frpc-watchdog started."
echo ""
echo "[Frps restart]"
./frpc -c /etc/storage/frpc/frpc.ini >/dev/null 2>&1 &
-----------------------------------------------------------------------------------------
frp停止代码
-------------------------------frpstop.sh--------------------------------------------
#!/bin/sh
kill -9 "`pidof frpc-watchdog`"
pid=$(ps | awk '/[f]rpc -c/{print $1}')
if [ "$pid" == "" ]; then
echo "[Frpc not running]"
else
echo "[Frpc stop]"
kill $pid
fi
---------------------------------------------------------------------------------------
守护进程
----------------------------frpc-watchdog(无后缀)------------------------------
#!/bin/sh
while true; do
sleep 60
pid=$(ps | awk '/[f]rpc -c/{print $1}')
if [ "$pid" == "" ]; then
/root/frpcstart.sh
else
echo ""
fi
done
----------------------------------------------------------------------------------
--------------------------------npcstart.sh------------------------------------
#!/bin/sh
cd /root
sh npcstop.sh
sleep 1
./npc-watchdog >/dev/null 2>&1 &
./npc -server=yourip.com:21001 -vkey=mhgat9xztm78 -type=tcp >/dev/null 2>&1 &
#./npc -config=/etc/storage/npc/npc.conf >/dev/null 2>&1 &
----------------------------------------------------------------------------------
---------------------------------npcstop.sh-------------------------------------------------
#!/bin/sh
kill -9 "`pidof npc-watchdog`"
pid=$(ps | awk '/[n]pc -config/{print $1}')
if [ "$pid" == "" ]; then
echo "[Npc not running]"
else
echo "[Npc stop]"
kill $pid
fi
#!/bin/sh
kill -9 "`pidof npc-watchdog`"
pid=$(ps | awk '/[n]pc -config/{print $1}')
if [ "$pid" == "" ]; then
echo "[Npc not running]"
else
echo "[Npc stop]"
kill $pid
fi
----------------------------------------------------------------------------------
没有评论:
发表评论