From faa80c5db56d88b7dbcf77f06b09c60cdee07c50 Mon Sep 17 00:00:00 2001 From: miluebbe Date: Thu, 16 May 2013 12:43:27 +0300 Subject: [PATCH] Update ambari-server --- ambari-server/etc/init.d/ambari-server | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ambari-server/etc/init.d/ambari-server b/ambari-server/etc/init.d/ambari-server index edc4d96ea9d..91667575375 100644 --- a/ambari-server/etc/init.d/ambari-server +++ b/ambari-server/etc/init.d/ambari-server @@ -19,6 +19,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +NAME=ambari-server +PIDFILE=/var/run/$NAME/$NAME.pid + case "$1" in start) /usr/sbin/ambari-server $@ @@ -27,7 +30,20 @@ case "$1" in /usr/sbin/ambari-server $@ ;; status) - /usr/sbin/ambari-server $@ + printf "%-50s" "Checking $NAME..." + if [ -f $PIDFILE ]; then + PID=`cat $PIDFILE` + if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then + printf "%s\n" "Process dead but pidfile exists" + exit 1 + else + echo "Running" + exit 0 + fi + else + printf "%s\n" "Service not running" + exit 1 + fi ;; restart) $0 stop