現在的時間是 2026-11-20, 13:44

所有顯示的時間為 UTC + 8 小時




 第 1 頁 (共 1 頁) [ 1 篇文章 ] 
發表人 內容
 文章主題 : Check OUI list, if changed than mail to JoeChen
文章發表於 : 2008-12-02, 11:49 
系統管理員
頭像

註冊時間: 2005-12-05, 16:08
文章: 473
path: /home/users/joechen/workshop/get_oui.sh

code:
-- Top of the code --
echo "Check OUI data..."
sleep 1
/bin/mv ./oui_ok.txt ./oui_ok.txt.old

echo "移除舊有的原始 OUI 列表..."
sleep 1
/bin/rm ./oui.txt

echo "取得原始 OUI 列表, 並取出必要資訊..."
sleep 1
/usr/bin/wget http://standards.ieee.org/regauth/oui/oui.txt
/bin/awk '$0 ~ /^0|^1|$2/' ./oui.txt > ./oui_tmp1.txt
/bin/sed /\(base\ 16\)/d ./oui_tmp1.txt > ./oui_tmp2.txt
/bin/sed s/\(hex\)/\ / ./oui_tmp2.txt > ./oui_tmp3.txt
/bin/sed s/\ \ // ./oui_tmp3.txt > ./oui_tmp4.txt
/bin/sed s/\ \ \ \// ./oui_tmp4.txt > ./oui_ok.txt
/bin/rm -f *tmp[1-4]*.txt

echo "比對新舊 OUI 資料是否相符..."
sleep 1
/usr/bin/diff ./oui_ok.txt.old ./oui_ok.txt > ./wc.txt

echo "查看 OUI 資料是否有異動, 若有, 將寄信給 Joe Chen..."
sleep 1
# check if out txt file is different
if [ -s wc.txt ]; then
echo "Check the different with above information..." >> ./wc.txt
mail -s "OUI 資料有異動" joechen@niu.edu.tw < ./wc.txt
echo "OUI 資料有異動, 已發信通知 Joe Chen"
else
echo "OUI 資料沒有異動, 不需通知"
exit 0
fi
-- Bottom of the code --

crontab -e
0 */6 * * * /home/users/joechen/workshop/get_oui.sh


離線
 個人資料  
 
顯示文章 :  排序  
 第 1 頁 (共 1 頁) [ 1 篇文章 ] 

所有顯示的時間為 UTC + 8 小時


誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 1 位訪客


您 不能 在這個版面發表主題
您 不能 在這個版面回覆主題
您 不能 在這個版面編輯您的文章
您 不能 在這個版面刪除您的文章
您 不能 在這個版面上傳附加檔案

搜尋:
前往 :  

cron