add a wrapper script

Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/0b3b5b9f
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/0b3b5b9f
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/0b3b5b9f

Branch: refs/heads/master
Commit: 0b3b5b9f4c2ff77b6fd05f495cf908ed32421ff5
Parents: 399b2bd
Author: LiuMing <[email protected]>
Authored: Sun Aug 5 14:34:07 2018 +0800
Committer: LiuMing <[email protected]>
Committed: Sun Aug 5 14:34:07 2018 +0800

----------------------------------------------------------------------
 core/sqf/sql/scripts/localstfscheck | 40 ++++++++++++++++++++++++++++++++
 core/sqf/sql/scripts/stfscheck      | 27 +++++++++++----------
 2 files changed, 53 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/0b3b5b9f/core/sqf/sql/scripts/localstfscheck
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/localstfscheck 
b/core/sqf/sql/scripts/localstfscheck
new file mode 100755
index 0000000..e30e51c
--- /dev/null
+++ b/core/sqf/sql/scripts/localstfscheck
@@ -0,0 +1,40 @@
+#!/bin/bash
+#
+# @@@ START COPYRIGHT @@@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# @@@ END COPYRIGHT @@@
+
+#this is to check the health of STFS
+
+#parse the ms.env
+
+stfspath=`dtmci showenv STFS_HDD_LOCATION`
+IFS=: DIRS=($stfspath)
+declare -p DIRS >/dev/null
+for ELEM in ${DIRS[@]}
+do
+  touch $ELEM/teststfs
+  if [ $? -ne 0 ]; then
+    echo "Scratch File test ERROR for  $ELEM@$HOSTNAME"
+    rm -f $ELEM/teststfs
+    exit 1
+  fi
+  rm -f $ELEM/teststfs
+done

http://git-wip-us.apache.org/repos/asf/trafodion/blob/0b3b5b9f/core/sqf/sql/scripts/stfscheck
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/stfscheck b/core/sqf/sql/scripts/stfscheck
index 015b9fe..1795bfc 100755
--- a/core/sqf/sql/scripts/stfscheck
+++ b/core/sqf/sql/scripts/stfscheck
@@ -23,17 +23,16 @@
 
 #this is to check the health of STFS
 
-#parse the ms.env
-
-stfspath=`dtmci showenv STFS_HDD_LOCATION`
-IFS=: DIRS=($stfspath) 
-declare -p DIRS
-for ELEM in ${DIRS[@]}
-do
-  touch $ELEM/teststfs 
-  if [ $? -ne 0 ]; then
-    echo "Scratch File test ERROR for  $ELEM@$HOSTNAME"
-    exit 1
-  fi
-  rm -f $ELEM/teststfs
-done
+if [ -e $SQ_PDSH ]; then
+ output=`$SQ_PDSH $MY_NODES localstfscheck`
+ echo $output | grep ERROR | grep Scratch
+ ol=`echo $output | grep ERROR | grep Scratch | wc -l`
+ if [ $ol -eq 0 ]; then
+  echo 'STFS is OK'
+ fi
+else
+ localstfscheck
+ if [ $? -eq 0 ]; then
+  echo 'STFS is OK'
+ fi
+fi

Reply via email to