bigtop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mackror...@apache.org
Subject [1/2] git commit: BIGTOP-1337:Fixing start and stop methods in init scripts
Date Tue, 19 Aug 2014 01:21:43 GMT
Repository: bigtop
Updated Branches:
  refs/heads/master 15df7049b -> e9771e613


BIGTOP-1337:Fixing start and stop methods in init scripts


Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/5b74d0fb
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/5b74d0fb
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/5b74d0fb

Branch: refs/heads/master
Commit: 5b74d0fbbc1006f53e52fed3bc7c94d68fd15547
Parents: 15df704
Author: Mani Narayan <nmani96@gmail.com>
Authored: Mon Aug 18 16:17:06 2014 -0700
Committer: Sean Mackrory <mackrorysd@apache.org>
Committed: Mon Aug 18 19:20:52 2014 -0600

----------------------------------------------------------------------
 .../src/common/hadoop/hadoop-hdfs-datanode.svc   |  9 +++++++--
 .../src/common/hadoop/hadoop-httpfs.svc          | 18 ++++++++++++++----
 bigtop-packages/src/common/hbase/hbase.svc       | 19 +++++++++++++++----
 bigtop-packages/src/common/hive/hive-server.svc  | 19 +++++++++++++++----
 bigtop-packages/src/common/hive/hive-server2.svc | 19 +++++++++++++++----
 bigtop-packages/src/templates/init.d.tmpl        | 16 ++++++++++++----
 6 files changed, 78 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/5b74d0fb/bigtop-packages/src/common/hadoop/hadoop-hdfs-datanode.svc
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/hadoop/hadoop-hdfs-datanode.svc b/bigtop-packages/src/common/hadoop/hadoop-hdfs-datanode.svc
index 10d45e4..bcca371 100644
--- a/bigtop-packages/src/common/hadoop/hadoop-hdfs-datanode.svc
+++ b/bigtop-packages/src/common/hadoop/hadoop-hdfs-datanode.svc
@@ -28,7 +28,6 @@ cat <<'__EOT__'
 start() {
   [ -x $EXEC_PATH ] || exit $ERROR_PROGRAM_NOT_INSTALLED
   [ -d $CONF_DIR ] || exit $ERROR_PROGRAM_NOT_CONFIGURED
-  log_success_msg "Starting ${DESC}: "
 
   if [ -n "$HADOOP_SECURE_DN_USER" ]; then
     TARGET_USER=root
@@ -44,7 +43,13 @@ start() {
   checkstatusofproc
   RETVAL=$?
 
-  [ $RETVAL -eq $RETVAL_SUCCESS ] && touch $LOCKFILE
+  if [ $RETVAL -eq $STATUS_RUNNING ]; then
+    touch $LOCKFILE
+    log_success_msg "Started ${DESC} (${DAEMON}): "
+  else
+    log_failure_msg "Failed to start ${DESC}. Return value: $RETVAL"
+  fi
+
   return $RETVAL
 }
 __EOT__

http://git-wip-us.apache.org/repos/asf/bigtop/blob/5b74d0fb/bigtop-packages/src/common/hadoop/hadoop-httpfs.svc
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/hadoop/hadoop-httpfs.svc b/bigtop-packages/src/common/hadoop/hadoop-httpfs.svc
index 1abda2c..4576f56 100644
--- a/bigtop-packages/src/common/hadoop/hadoop-httpfs.svc
+++ b/bigtop-packages/src/common/hadoop/hadoop-httpfs.svc
@@ -31,7 +31,6 @@ cat <<'__EOT__'
 start() {
   [ -x $EXEC_PATH ] || exit $ERROR_PROGRAM_NOT_INSTALLED
   [ -d $CONF_DIR ] || exit $ERROR_PROGRAM_NOT_CONFIGURED
-  log_success_msg "Starting ${DESC}: "
 
   export HTTPFS_USER="$SVC_USER"
   export HTTPFS_CONFIG="$CONF_DIR"
@@ -56,7 +55,13 @@ start() {
     sleep 1
   done
 
-  [ $RETVAL -eq $RETVAL_SUCCESS ] && touch $LOCKFILE
+  if [ $RETVAL -eq $STATUS_RUNNING ]; then
+    touch $LOCKFILE
+    log_success_msg "Started ${DESC} (${DAEMON}): "
+  else
+    log_failure_msg "Failed to start ${DESC}. Return value: $RETVAL"
+  fi
+
   return $RETVAL
 }
 __EOT__
@@ -67,7 +72,7 @@ generate_stop() {
 
 cat <<'__EOT__'
 stop() {
-  log_success_msg "Stopping ${DESC}: "
+
   # FIXME: workaround for BIGTOP-537
   checkstatusofproc
   if [ "$?" = "$STATUS_RUNNING" ] ; then
@@ -77,7 +82,12 @@ stop() {
     RETVAL=$RETVAL_SUCCESS
   fi
 
-  [ $RETVAL -eq $RETVAL_SUCCESS ] && rm -f $LOCKFILE $PIDFILE
+  if [ $RETVAL -eq $RETVAL_SUCCESS ]; then
+    log_success_msg "Stopped ${DESC}: "
+    rm -f $LOCKFILE $PIDFILE
+  else
+    log_failure_msg "Failure to stop ${DESC}. Return value: $RETVAL"
+  fi
 }
 __EOT__
 

http://git-wip-us.apache.org/repos/asf/bigtop/blob/5b74d0fb/bigtop-packages/src/common/hbase/hbase.svc
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/hbase/hbase.svc b/bigtop-packages/src/common/hbase/hbase.svc
index 7c92dc9..ec54d08 100644
--- a/bigtop-packages/src/common/hbase/hbase.svc
+++ b/bigtop-packages/src/common/hbase/hbase.svc
@@ -41,7 +41,6 @@ start() {
     hbase_env
 
     [ -x $EXEC_PATH ] || exit $ERROR_PROGRAM_NOT_INSTALLED
-    log_success_msg "Starting $DESC (${DAEMON}): "
 
     checkstatusofproc
     status=$?
@@ -54,7 +53,14 @@ start() {
 
     checkstatusofproc
     RETVAL=$?
-    [ $RETVAL -eq $STATUS_RUNNING ] && touch $LOCKFILE
+
+    if [ $RETVAL -eq $STATUS_RUNNING ]; then
+      touch $LOCKFILE
+      log_success_msg "Started ${DESC} (${DAEMON}): "
+    else
+      log_failure_msg "Failed to start ${DESC}. Return value: $RETVAL"
+    fi
+
     return $RETVAL
 }
 __EOT__
@@ -67,12 +73,17 @@ cat <<'__EOT__'
 stop() {
     hbase_env
 
-    log_success_msg "Stopping $DESC (${DAEMON}): "
     su -s /bin/bash hbase -c "${EXEC_PATH} stop @HBASE_DAEMON@"
     sleep 3
     RETVAL=$?
 
-    [ $RETVAL -eq $RETVAL_SUCCESS ] && rm -f $LOCKFILE $PIDFILE
+    if [ $RETVAL -eq $RETVAL_SUCCESS ]; then
+      log_success_msg "Stopped ${DESC}: "
+      rm -f $LOCKFILE $PIDFILE
+    else
+      log_failure_msg "Failure to stop ${DESC}. Return value: $RETVAL"
+    fi
+
     return $RETVAL
 }
 __EOT__

http://git-wip-us.apache.org/repos/asf/bigtop/blob/5b74d0fb/bigtop-packages/src/common/hive/hive-server.svc
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/hive/hive-server.svc b/bigtop-packages/src/common/hive/hive-server.svc
index 43fc761..8e60b72 100644
--- a/bigtop-packages/src/common/hive/hive-server.svc
+++ b/bigtop-packages/src/common/hive/hive-server.svc
@@ -27,7 +27,6 @@ generate_start() {
 cat <<'__EOT__'
 start() {
     [ -x $EXE_FILE ] || exit $ERROR_PROGRAM_NOT_INSTALLED
-    log_success_msg "Starting $DESC (${DAEMON}): "
 
     checkstatusofproc
     status=$?
@@ -51,7 +50,14 @@ start() {
 
     checkstatusofproc
     RETVAL=$?
-    [ $RETVAL -eq $STATUS_RUNNING ] && touch $LOCKFILE
+
+    if [ $RETVAL -eq $STATUS_RUNNING ]; then
+      touch $LOCKFILE
+      log_success_msg "Started ${DESC} (${DAEMON}) : "
+    else
+      log_failure_msg "Failed to start ${DESC}. Return value: $RETVAL"
+    fi
+
     return $RETVAL
 }
 __EOT__
@@ -62,11 +68,16 @@ generate_stop() {
 
 cat <<'__EOT__'
 stop() {
-    log_success_msg "Stopping $DESC (${DAEMON}): "
     killproc -p $PIDFILE java
     RETVAL=$?
 
-    [ $RETVAL -eq $RETVAL_SUCCESS ] && rm -f $LOCKFILE $PIDFILE
+    if [ $RETVAL -eq $RETVAL_SUCCESS ]; then
+      log_success_msg "Stopped ${DESC}: "
+      rm -f $LOCKFILE $PIDFILE
+    else
+      log_failure_msg "Failure to stop ${DESC}. Return value: $RETVAL"
+    fi
+
     return $RETVAL
 }
 __EOT__

http://git-wip-us.apache.org/repos/asf/bigtop/blob/5b74d0fb/bigtop-packages/src/common/hive/hive-server2.svc
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/hive/hive-server2.svc b/bigtop-packages/src/common/hive/hive-server2.svc
index 09a7a6e..9cacf7b 100644
--- a/bigtop-packages/src/common/hive/hive-server2.svc
+++ b/bigtop-packages/src/common/hive/hive-server2.svc
@@ -27,7 +27,6 @@ generate_start() {
 cat <<'__EOT__'
 start() {
     [ -x $EXE_FILE ] || exit $ERROR_PROGRAM_NOT_INSTALLED
-    log_success_msg "Starting $DESC (${DAEMON}): "
 
     checkstatusofproc
     status=$?
@@ -47,7 +46,14 @@ start() {
 
     checkstatusofproc
     RETVAL=$?
-    [ $RETVAL -eq $STATUS_RUNNING ] && touch $LOCKFILE
+
+    if [ $RETVAL -eq $STATUS_RUNNING ]; then
+      touch $LOCKFILE
+      log_success_msg "Started ${DESC} (${DAEMON}): "
+    else
+      log_failure_msg "Failed to start ${DESC}. Return value: $RETVAL"
+    fi
+
     return $RETVAL
 }
 __EOT__
@@ -58,11 +64,16 @@ generate_stop() {
 
 cat <<'__EOT__'
 stop() {
-    log_success_msg "Stopping $DESC (${DAEMON}): "
     killproc -p $PIDFILE java
     RETVAL=$?
 
-    [ $RETVAL -eq $RETVAL_SUCCESS ] && rm -f $LOCKFILE $PIDFILE
+    if [ $RETVAL -eq $RETVAL_SUCCESS ]; then
+      log_success_msg "Stopped ${DESC}: "
+      rm -f $LOCKFILE $PIDFILE
+    else
+      log_failure_msg "Failure to stop ${DESC}. Return value: $RETVAL"
+    fi
+
     return $RETVAL
 }
 __EOT__

http://git-wip-us.apache.org/repos/asf/bigtop/blob/5b74d0fb/bigtop-packages/src/templates/init.d.tmpl
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/templates/init.d.tmpl b/bigtop-packages/src/templates/init.d.tmpl
old mode 100644
new mode 100755
index 5792324..8391ad5
--- a/bigtop-packages/src/templates/init.d.tmpl
+++ b/bigtop-packages/src/templates/init.d.tmpl
@@ -82,7 +82,6 @@ cat <<'__EOT__'
 start() {
   [ -x $EXEC_PATH ] || exit $ERROR_PROGRAM_NOT_INSTALLED
   [ -d $CONF_DIR ] || exit $ERROR_PROGRAM_NOT_CONFIGURED
-  log_success_msg "Starting ${DESC}: "
 
   su -s /bin/bash $SVC_USER -c "cd $WORKING_DIR && $EXEC_PATH --config '$CONF_DIR'
start $DAEMON_FLAGS"
 
@@ -91,7 +90,12 @@ start() {
   checkstatusofproc
   RETVAL=$?
 
-  [ $RETVAL -eq $RETVAL_SUCCESS ] && touch $LOCKFILE
+  if [ $RETVAL -eq $STATUS_RUNNING ]; then
+    touch $LOCKFILE
+    log_success_msg "Started ${DESC}: "
+  else
+	log_failure_msg "Failed to start ${DESC}. Return value: $RETVAL"
+  fi
   return $RETVAL
 }
 
@@ -104,11 +108,15 @@ generate_stop() {
 cat <<'__EOT__'
 
 stop() {
-  log_success_msg "Stopping ${DESC}: "
   start_daemon $EXEC_PATH --config "$CONF_DIR" stop $DAEMON_FLAGS
   RETVAL=$?
 
-  [ $RETVAL -eq $RETVAL_SUCCESS ] && rm -f $LOCKFILE $PIDFILE
+  if [ $RETVAL -eq $RETVAL_SUCCESS ]; then
+	 log_success_msg "Stopped ${DESC}: "
+	 rm -f $LOCKFILE $PIDFILE
+ else
+	 log_failure_msg "Failed to stop ${DESC}. Return value: $RETVAL."
+ fi
 }
 
 __EOT__


Mime
View raw message