From bf28bae65a6f6ddee65adfc9bee19f5f58cebb2a Mon Sep 17 00:00:00 2001
From: brinn <brinn>
Date: Thu, 13 Sep 2012 16:21:27 +0000
Subject: [PATCH] Add check.sh to do check of accessibility of the API.

SVN: 26623
---
 openbis/dist/server/check.sh | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100755 openbis/dist/server/check.sh

diff --git a/openbis/dist/server/check.sh b/openbis/dist/server/check.sh
new file mode 100755
index 00000000000..023e9809f2f
--- /dev/null
+++ b/openbis/dist/server/check.sh
@@ -0,0 +1,26 @@
+#! /bin/bash
+
+# API access check script for CISD openBIS Application Server on Unix / Linux systems
+# -----------------------------------------------------------------------------------
+
+source `dirname "$0"`/setup-env
+
+AWK=`awkBin`
+
+printCheckResult()
+{
+  if [ "$1" == "-q" ]; then
+    QUIET=1
+  fi
+  VAL=`curl --insecure --connect-timeout 10 https://localhost:8443/openbis/openbis/rmi-general-information-v1.json -H "Content-Type: application/json" -H "Accept: application/json" --data '{"id": "1", "jsonrpc": "2.0", "method": "getMinorVersion"}' 2> /dev/null | $AWK '/{"jsonrpc":"2.0","id":"1","result":[0-9]+}/ { print "OK" }'`
+  EVAL=$?
+  if [ $EVAL -eq 0 -a "$VAL" = "OK" ]; then
+    test -z "$QUIET" && echo "Check successful"
+    return 0
+  else
+    test -z "$QUIET" && echo "Check failed"
+    return 1
+  fi
+}
+
+printCheckResult "$1"
-- 
GitLab