Openwrt 自动运行 Frp Server 脚本

在 2020年12月21日 23点47分 发布于 Openwrt 分类

# Download
FD=`ls /tmp | grep frps$`
if [ "$FD" != "" ]; then
echo \[$(date)\] frps exists! >> /tmp/frps.log
echo \[$(date)\] frps exists!
else
wget http://10.10.10.11:8085/tmp/frps -O /tmp/frps
chmod 777 /tmp/frps
echo \[$(date)\] frps binary is downloaded! >> /tmp/frps.log
echo \[$(date)\] frps binary is downloaded!
fi

# Verify the binary file
MD5=`md5sum /tmp/frps | awk '{print $1}'`
if [ $MD5 != "482396c262bcf4fdf8c04dc081ab267f" ]; then
echo "Invalid binary file! Delete and Download again!" >> /tmp/frps.log
echo "Invalid binary file! Delete and Download again!"
rm /tmp/frps
wget https://pan.lod.pub/tmp/frps -O /tmp/frps
chmod 777 /tmp/frps
else
echo "Binary verification passed!" >> /tmp/frps.log
echo "Binary verification passed!"
fi

# Run
PIDS=`ps | grep ./frps | grep frps.ini | awk '{print $1}'`
if [ "$PIDS" != "" ]; then
echo \[$(date)\] frp server is runing! >> /tmp/frps.log
echo \[$(date)\] frp server is runing!
else
screen -wipe
screen -dmS frps /tmp/frps -c /root/frps.ini
echo \[$(date)\] Frp server start! >> /tmp/frps.log
echo \[$(date)\] Frp server start!
fi