OPENWRT Cron定時執行檢查LOG - Linux

By Ivy
at 2018-04-14T08:59
at 2018-04-14T08:59
Table of Contents
大家好~~
目前有一台MTK路由器
因為驅動的問題,無線都會不定時出錯
出錯就要重開才會正常
所以我想要用定時檢查
目前卡在條件判斷式的寫法
cron 排程
1 0 0 0 0 /root/wifi_watchdog.sh
剛剛發現排程錯了 應該是
*/1 * * * * /root/wifi_watchdog.sh 一分鐘一次
批次檔
#!/bin/sh
#擷取網卡錯誤紀錄
dmesg|grep rt2x00queue_write_tx_frame>>/tmp/log.txt
#檢查檔案大小
if [ du -a /tmp/log.txt>0]; then
reboot
fi
卡在檢查完大小,我不知道那個數字要比對大於零的寫法
目前這樣寫是過不了
有大於零代表出錯
我只要抓到有大於零就要重開機
這樣要如何撰寫
--
目前有一台MTK路由器
因為驅動的問題,無線都會不定時出錯
出錯就要重開才會正常
所以我想要用定時檢查
目前卡在條件判斷式的寫法
cron 排程
1 0 0 0 0 /root/wifi_watchdog.sh
剛剛發現排程錯了 應該是
*/1 * * * * /root/wifi_watchdog.sh 一分鐘一次
批次檔
#!/bin/sh
#擷取網卡錯誤紀錄
dmesg|grep rt2x00queue_write_tx_frame>>/tmp/log.txt
#檢查檔案大小
if [ du -a /tmp/log.txt>0]; then
reboot
fi
卡在檢查完大小,我不知道那個數字要比對大於零的寫法
目前這樣寫是過不了
有大於零代表出錯
我只要抓到有大於零就要重開機
這樣要如何撰寫
--
Tags:
Linux
All Comments

By Todd Johnson
at 2018-04-19T08:48
at 2018-04-19T08:48

By Lauren
at 2018-04-20T09:28
at 2018-04-20T09:28

By Hedy
at 2018-04-22T18:38
at 2018-04-22T18:38

By Todd Johnson
at 2018-04-23T21:07
at 2018-04-23T21:07

By Tracy
at 2018-04-26T23:10
at 2018-04-26T23:10

By Olga
at 2018-05-01T13:38
at 2018-05-01T13:38
Related Posts
speedometer指令

By Jake
at 2018-04-12T13:08
at 2018-04-12T13:08
speedometer指令

By Oscar
at 2018-04-12T09:46
at 2018-04-12T09:46
Ubuntu 16.04 自動登出

By Christine
at 2018-04-12T09:07
at 2018-04-12T09:07
kali live on surface pro 失敗

By Elvira
at 2018-04-11T10:00
at 2018-04-11T10:00
PCIe 重新啟動

By Barb Cronin
at 2018-04-10T15:03
at 2018-04-10T15:03