# HG changeset patch
# User Alexander Krauth <li...@sap.com>
# Date 1293626183 -3600
# Node ID 423a10a08bfa485da2e461fde7fac400aba9b831
# Parent  7b748215095e6f0f7cace3176f2b30932acb739d
High: SAPDatabase: Fixed wrong scope of rc variable in service_start/stop 
functions

diff -r 7b748215095e -r 423a10a08bfa heartbeat/SAPDatabase
--- a/heartbeat/SAPDatabase     Mon Dec 20 21:23:27 2010 +0100
+++ b/heartbeat/SAPDatabase     Wed Dec 29 13:36:23 2010 +0100
@@ -178,26 +178,27 @@
 # listener_start: Start the given listener
 #
 listener_start() {
-  orasid="ora`echo $SID | tr '[:upper:]' '[:lower:]'`"
-  rc=$OCF_SUCCESS
+  local orasid="ora`echo $SID | tr '[:upper:]' '[:lower:]'`"
+  local lrc=$OCF_SUCCESS
+  local output
   output=`echo "lsnrctl start $NETSERVICENAME" | su - $orasid 2>&1`
   if [ $? -eq 0 ]
   then
     ocf_log info "Oracle Listener $NETSERVICENAME started: $output"
-    rc=$OCF_SUCCESS
+    lrc=$OCF_SUCCESS
   else
     ocf_log err "Oracle Listener $NETSERVICENAME start failed: $output"
-    rc=$OCF_ERR_GENERIC
+    lrc=$OCF_ERR_GENERIC
   fi
-  return $rc
+  return $lrc
 }
 
 #
 # listener_stop: Stop the given listener
 #
 listener_stop() {
-  orasid="ora`echo $SID | tr '[:upper:]' '[:lower:]'`"
-  rc=$OCF_SUCCESS
+  local orasid="ora`echo $SID | tr '[:upper:]' '[:lower:]'`"
+  local lrc=$OCF_SUCCESS
   if
       listener_status
   then
@@ -205,84 +206,89 @@
   else
       return $OCF_SUCCESS
   fi
+  local output
   output=`echo "lsnrctl stop $NETSERVICENAME" | su - $orasid 2>&1`
   if [ $? -eq 0 ]
   then
     ocf_log info "Oracle Listener $NETSERVICENAME stopped: $output"
   else
     ocf_log err "Oracle Listener $NETSERVICENAME stop failed: $output"
-    rc=$OCF_ERR_GENERIC
+    lrc=$OCF_ERR_GENERIC
   fi
-  return $rc
+  return $lrc
 }
 
 #
 # listener_status: is the given listener running?
 #
 listener_status() {
-  orasid="ora`echo $SID | tr '[:upper:]' '[:lower:]'`"
+  local lrc=$OCF_SUCCESS
+  local orasid="ora`echo $SID | tr '[:upper:]' '[:lower:]'`"
   # Note: ps cuts off it's output at column $COLUMNS, so "ps -ef" can not be 
used here
   # as the output might be to long.
-  cnt=`ps efo args --user $orasid | grep $NETSERVICENAME | grep -c tnslsnr`
+  local cnt=`ps efo args --user $orasid | grep $NETSERVICENAME | grep -c 
tnslsnr`
   if [ $cnt -eq 1 ]
   then
-    rc=$OCF_SUCCESS
+    lrc=$OCF_SUCCESS
   else
     ocf_log info "listener process not running for $NETSERVICENAME for $SID"
-    rc=$OCF_ERR_GENERIC
+    lrc=$OCF_ERR_GENERIC
   fi
-  return $rc
+  return $lrc
 }
 
 #
 # x_server_start: Start the given x_server
 #
 x_server_start() {
-  rc=$OCF_SUCCESS
+  local rc=$OCF_SUCCESS
+  local output
   output=`echo "x_server start" | su - $sidadm 2>&1`
   if [ $? -eq 0 ]
   then
     ocf_log info "MaxDB x_server start: $output"
-    rc=$OCF_SUCCESS
+    lrc=$OCF_SUCCESS
   else
     ocf_log err "MaxDB x_server start failed: $output"
-    rc=$OCF_ERR_GENERIC
+    lrc=$OCF_ERR_GENERIC
   fi
-  return $rc
+  return $lrc
 }
 
 #
 # x_server_stop: Stop the x_server
 #
 x_server_stop() {
-  rc=$OCF_SUCCESS
+  local lrc=$OCF_SUCCESS
+  local output
   output=`echo "x_server stop" | su - $sidadm 2>&1`
   if [ $? -eq 0 ]
   then
     ocf_log info "MaxDB x_server stop: $output"
   else
     ocf_log err "MaxDB x_server stop failed: $output"
-    rc=$OCF_ERR_GENERIC
+    lrc=$OCF_ERR_GENERIC
   fi
-  return $rc
+  return $lrc
 }
 
 #
 # x_server_status: is the x_server running?
 #
 x_server_status() {
-  sdbuser=`grep "^SdbOwner" /etc/opt/sdb | awk -F'=' '{print $2}'`
+  local lrc=$OCF_SUCCESS
+  local sdbuser=`grep "^SdbOwner" /etc/opt/sdb | awk -F'=' '{print $2}'`
   # Note: ps cuts off it's output at column $COLUMNS, so "ps -ef" can not be 
used here
   # as the output might be to long.
-  cnt=`ps efo args --user $sdbuser | grep -c vserver`
+  local cnt=`ps efo args --user $sdbuser | grep -c vserver`
   if [ $cnt -ge 1 ]
   then
-    rc=$OCF_SUCCESS
+    lrc=$OCF_SUCCESS
   else
     ocf_log info "x_server process not running"
-    rc=$OCF_ERR_GENERIC
+    lrc=$OCF_ERR_GENERIC
   fi
-  return $rc
+  return $lrc
 }
 
 #
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to