From 41a599d03282f6a3bb16bcdbdd12cef3d681c6c2 Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Thu, 21 Jul 2016 16:11:52 +0200 Subject: [PATCH] Adds status to the ubuntu 14.04 flow and gate init.d scripts --- share/pkgs/Ubuntu/opennebula-flow | 12 ++++++++++++ share/pkgs/Ubuntu/opennebula-gate | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/share/pkgs/Ubuntu/opennebula-flow b/share/pkgs/Ubuntu/opennebula-flow index 6467dd9476..b670b8b05b 100755 --- a/share/pkgs/Ubuntu/opennebula-flow +++ b/share/pkgs/Ubuntu/opennebula-flow @@ -17,6 +17,7 @@ NAME=oneflow-server DAEMON=/usr/bin/$NAME DAEMON_ARGS="" SCRIPTNAME=/etc/init.d/$NAME +PID_FILE=/var/run/one/oneflow.pid # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 @@ -63,6 +64,17 @@ case "$1" in 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; + status) + PID=`cat $PID_FILE` + kill -0 $PID > /dev/null 2>&1 + if [ "$?" -eq "0" ]; then + log_daemon_msg "$NAME is running" + log_end_msg 0 + else + log_daemon_msg "$NAME is not running" + log_end_msg 1 + fi + ;; restart|force-reload) # # If the "reload" option is implemented then remove the diff --git a/share/pkgs/Ubuntu/opennebula-gate b/share/pkgs/Ubuntu/opennebula-gate index 613f2614ef..f4d7471df2 100755 --- a/share/pkgs/Ubuntu/opennebula-gate +++ b/share/pkgs/Ubuntu/opennebula-gate @@ -17,6 +17,7 @@ NAME=onegate-server DAEMON=/usr/bin/$NAME DAEMON_ARGS="" SCRIPTNAME=/etc/init.d/$NAME +PID_FILE=/var/run/one/onegate.pid # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 @@ -63,6 +64,17 @@ case "$1" in 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; + status) + PID=`cat $PID_FILE` + kill -0 $PID > /dev/null 2>&1 + if [ "$?" -eq "0" ]; then + log_daemon_msg "$NAME is running" + log_end_msg 0 + else + log_daemon_msg "$NAME is not running" + log_end_msg 1 + fi + ;; restart|force-reload) # # If the "reload" option is implemented then remove the