Cloudflare Tunnel 断开连接自动重启脚本

October 4, 2022 • 记事

Cloudflare 经常断开连接,所以写了一个脚本,通过 HTTP 状态码,来判断 Tunnel 是否断开连接。

#!/bin/bash
MY_URL="https://网站/"
RESULT=`curl -I $MY_URL|grep "200"`
if [ -n "$RESULT" ];
then
        echo "正常运行"
else
        echo "正在重启" && service cloudflared restart && echo "已经重启"
fi
Last Modified: January 31, 2023
Archives QR Code
QR Code for this page
Tipping QR Code