1. 新建文件/etc/storage/fudan.sh
,內(nèi)容如下:
ping -c 1 -w 1 www.baidu.com
if [ "$?" -ne 0 ]; then
# echo "檢測(cè)到網(wǎng)絡(luò)斷開(kāi),嘗試重新登錄……"
logger -t "【Fudan】" "檢測(cè)到網(wǎng)絡(luò)斷開(kāi)耸黑,嘗試重新登錄……"
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 "網(wǎng)絡(luò)正常填具,無(wú)需重連"
logger -t "【Fudan】" "網(wǎng)絡(luò)正常欢揖,無(wú)需重連"
fi
2. 啟動(dòng)后執(zhí)行并寫(xiě)入計(jì)劃任務(wù)
/etc/storage/fudan.sh
echo "1 3 * * * /etc/storage/fudan.sh" >> /etc/storage/cron/crontabs/admin
3. 斷網(wǎng)自動(dòng)重連
自定義設(shè)置 - 網(wǎng)絡(luò)檢測(cè)
# Fudan
if [ $1 -eq 0 ]; then
/etc/storage/fudan.sh
logger -t "【Fudan重連】" "斷網(wǎng)自動(dòng)重連"
fi