1. 新建文件/etc/storage/fudan.sh
,内容如下:
ping -c 1 -w 1 www.baidu.com
if [ "$?" -ne 0 ]; then
# echo "检测到网络断开,尝试重新登录……"
logger -t "【Fudan】" "检测到网络断开,尝试重新登录……"
curl "https://10.108.255.249/include/auth_action.php" --insecure --data "action=login&username=your_username&password=your_password&ac_id=1&user_ip=$ip&nas_ip=&user_mac=&save_me=1&ajax=1"
logger -t "【Fudan】" "登录成功"
else
# echo "网络正常,无需重连"
logger -t "【Fudan】" "网络正常,无需重连"
fi
2. 启动后执行并写入计划任务
/etc/storage/fudan.sh
echo "1 3 * * * /etc/storage/fudan.sh" >> /etc/storage/cron/crontabs/admin
3. 断网自动重连
自定义设置 - 网络检测
# Fudan
if [ $1 -eq 0 ]; then
/etc/storage/fudan.sh
logger -t "【Fudan重连】" "断网自动重连"
fi
网友评论