Updated Branches: refs/heads/RCs 40fd08f2a -> 6f8e5217e refs/heads/master 97390e070 -> 89f7117f2
BIGTOP-836. Hue status on SuSE doesn't work when run from outside of /usr/bin (Mark Grover via rvs) Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/89f7117f Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/89f7117f Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/89f7117f Branch: refs/heads/master Commit: 89f7117f207c0b643ae157e8992ae7e0ef0111c2 Parents: 97390e0 Author: Roman Shaposhnik <[email protected]> Authored: Mon Feb 18 18:35:11 2013 -0800 Committer: Roman Shaposhnik <[email protected]> Committed: Mon Feb 18 18:35:17 2013 -0800 ---------------------------------------------------------------------- bigtop-packages/src/rpm/hue/SOURCES/hue.init.suse | 53 +++++++++------- 1 files changed, 30 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/89f7117f/bigtop-packages/src/rpm/hue/SOURCES/hue.init.suse ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/rpm/hue/SOURCES/hue.init.suse b/bigtop-packages/src/rpm/hue/SOURCES/hue.init.suse index 7605285..5be4eb6 100644 --- a/bigtop-packages/src/rpm/hue/SOURCES/hue.init.suse +++ b/bigtop-packages/src/rpm/hue/SOURCES/hue.init.suse @@ -76,7 +76,7 @@ hue_start() { hue_stop() { if [ ! -e $PIDFILE ]; then - success "Hue is not running" + log_success_msg "Hue is not running" return 0 fi @@ -104,30 +104,37 @@ hue_restart() { checkstatus(){ - # -L flag to follow symlinks is not in LSB spec and is distro specific - # It exists in SLES and therefore ok to be used here. It may or may not - # exist in other distros - pidofproc -L -p $PIDFILE python > /dev/null - status=$? - - case "$status" in - $STATUS_RUNNING) - log_success_msg "$DESC is running" - ;; - $STATUS_DEAD) - log_failure_msg "$DESC is dead and pid file exists" - ;; - $STATUS_DEAD_AND_LOCK) + pid=`cat "$PIDFILE" 2>/dev/null` + if [ "$pid" = '' ]; then + # The pidfile probably does not exist or is empty. + if [ -e $LOCKFILE ]; then log_failure_msg "$DESC is dead and lock file exists" - ;; - $STATUS_NOT_RUNNING) + RETVAL=$STATUS_DEAD_AND_LOCK + else log_failure_msg "$DESC is not running" - ;; - *) - log_failure_msg "$DESC status is unknown" - ;; - esac - return $status + RETVAL=$STATUS_NOT_RUNNING + fi + return $RETVAL + fi + + set -- $pid + pid="$1" + ps -fp $pid | grep $pid | grep -i hue > /dev/null 2>&1 + status=$? + + if [ "$status" = 0 ]; then + log_success_msg "$DESC is running" + RETVAL=$STATUS_RUNNING + elif [ -e $LOCKFILE ]; then + log_failure_msg "$DESC is dead and lock file exists" + RETVAL=$STATUS_DEAD_AND_LOCK + else + # pidfile exists, that's how we ended up here (by checking the + # the pid's status through ps + log_failure_msg "$DESC is dead and pid file exists" + RETVAL=$STATUS_DEAD + fi +return $RETVAL } hue_condrestart(){
