因為Server太多了,所以常常那台當了都不知道,所以就寫了這隻Script來抓每一台Server的狀態,寫法很爛,就是wget後,再判斷有沒有抓到某個字串,有就是正常
#!/bin/sh DATE_STR=`date +%Y%m%d` WEBs="1 2 3 4 5" echo "" echo "================================================" echo "= Server Sattus : $DATE_STR" echo "================================================" for i in ${WEBs}; do wget http://xx.xx.xx.${i} -q -O "/home/log/check/${i}" if [ -n "`cat "/home/log/check/${i}" | grep ""`" ]; then echo "Server ${i}: Alive" else echo "Server ${i}: Dead **********" fi done echo "================================================" echo "= Done " echo "================================================" echo ""
0 comments:
張貼留言