summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristian Franke <nobody@nowhere.ws>2011-05-20 18:41:42 +0200
committerChristian Franke <nobody@nowhere.ws>2011-05-20 18:41:42 +0200
commita6562213997b4cfa3840379b234aa9f8c6b9b437 (patch)
tree62820976f352b2835f0df81db0d143c37b84b3ab /scripts
parent3a447fa8af10467768836d57b33e88ca1ec35aeb (diff)
Added API status report, as nowhere.ws will no longer serve it
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/pingscript20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/pingscript b/scripts/pingscript
index 80b1a74..1424eef 100755
--- a/scripts/pingscript
+++ b/scripts/pingscript
@@ -15,11 +15,19 @@ insertstatus() {
fi
cp ${WEBPATH}/csstemplate/${status}.${1}.status.css ${WEBPATH}/public/css/${1}.status.css.new
mv -f ${WEBPATH}/public/css/${1}.status.css.new ${WEBPATH}/public/css/${1}.status.css
+
+ return $ec
+}
+
+apistatus() {
+ [ -d "${WEBPATH}/public/api" ] || mkdir -p "${WEBPATH}/public/api"
+ echo $1 > "${WEBPATH}/public/api/status"
}
# Ping Taifun
ping -q -c 2 -W 1 172.22.83.5 &> /dev/null
insertstatus taifun
+global_state=$?
# Ping Trieste
ping -q -c 2 -W 1 172.22.80.4 &> /dev/null
@@ -28,5 +36,17 @@ insertstatus trieste
# Ping Nautilus
ping -q -c 2 -W 1 172.22.80.7 &> /dev/null
insertstatus nautilus
+there_state=$?
+
+if [ $global_state -eq 0 ]; then
+ if [ $there_state -eq 0 ]; then
+ apistatus open
+ else
+ apistatus closed
+ fi
+else
+ apistatus unknown
+fi
+
exit 0