可以有人幫忙/糾正我寫一個shell腳本,這裏是我想要做的網頁獲取網頁的內容,並比較
- 獲取內容
- 比較內容
- 如果內容相同則返回0
- 如果不返回2
這裏是我的代碼
for cluster in $CLUSTERS
do
for applis in $(eval echo \$${cluster}_APPLIS)
do
CONTENT=$(wget -q -O - "http://$server/$applis")
if [ "$CONTENT" -eq 1 ]
then
exit_code=0
else
exit_code=2
fi
done
done
[[ -z "$error_server" ]] && error_server="aucune"
case $exit_code in
"2")
echo "CRITICAL - App Version Mismatch"
exit 2
;;
"1")
echo "WARNING - instance(s) indisponible(s)"
exit 1
;;
"0")
echo "OK - All apps have the save version"
exit 0
;;
*)
echo "CRITICAL - there's something wrong with this script ..."
exit 2
;;
esac
任何幫助或建議,將不勝感激
問候 的Fab
遺憾的錯誤標籤,我已經把它換成正確的一個 – user2106999 2013-02-25 13:43:05