Hello,
I'm writing a shell script to wget content web pages from multiple server into a variable and compare
if they match return 0 or return 2
#!/bin/bash
# Cluster 1
CLUSTER1_SERVERS="srv1 srv2 srv3 srv4"
CLUSTER1_APPLIS="test/version.html test2.version.jsp"
# Liste des clusters � tester
CLUSTERS="CLUSTER 1"
# Liste des servers � tester
SERVERS="CLUSTER1_SERVERS"
# init vars
CRITICAL=2
WARNING=1
OK=0
for applis in $CLUSTER1_APPLIS
do
CONTENT=$(wget -q -O - "http://$SERVERS/$applis")
if [ "$CONTENT" != 1 ]
then
exit_code=2
else
exit_code=0
fi
done
case $exit_code in
"2")
echo "CRITICAL - App Version Mismatch"
exit 2
;;
"1")
echo "WARNING"
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
this script dosent seems to work, i think there is some pbr in the line (comparison)
if [ "$CONTENT" != 1 ]
any help or suggestions
thanks in advance
gtam