From 8be4a1f09b00c4683355a020b5738dd2a2bbd21e Mon Sep 17 00:00:00 2001 From: Boris Parak Date: Wed, 30 Apr 2014 20:23:04 +0200 Subject: [PATCH] Added `status` to Sunstone init scripts for Ubuntu --- share/pkgs/Ubuntu/opennebula-econe | 12 ++++++++++++ share/pkgs/Ubuntu/opennebula-occi | 12 ++++++++++++ share/pkgs/Ubuntu/opennebula-sunstone | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/share/pkgs/Ubuntu/opennebula-econe b/share/pkgs/Ubuntu/opennebula-econe index db2bbd625a..e600edc1ad 100755 --- a/share/pkgs/Ubuntu/opennebula-econe +++ b/share/pkgs/Ubuntu/opennebula-econe @@ -17,6 +17,7 @@ NAME=econe-server DAEMON=/usr/bin/$NAME DAEMON_ARGS="" SCRIPTNAME=/etc/init.d/$NAME +PID_FILE=/var/run/one/econe-server.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) + ECONE_PID=`cat $PID_FILE` + kill -0 $ECONE_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-occi b/share/pkgs/Ubuntu/opennebula-occi index c0816c2811..2907984805 100755 --- a/share/pkgs/Ubuntu/opennebula-occi +++ b/share/pkgs/Ubuntu/opennebula-occi @@ -17,6 +17,7 @@ NAME=occi-server DAEMON=/usr/bin/$NAME DAEMON_ARGS="" SCRIPTNAME=/etc/init.d/$NAME +PID_FILE=/var/run/one/occi-server.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) + OCCI_PID=`cat $PID_FILE` + kill -0 $OCCI_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-sunstone b/share/pkgs/Ubuntu/opennebula-sunstone index f7917044d3..1148a37f6f 100755 --- a/share/pkgs/Ubuntu/opennebula-sunstone +++ b/share/pkgs/Ubuntu/opennebula-sunstone @@ -17,6 +17,7 @@ NAME=sunstone-server DAEMON=/usr/bin/$NAME DAEMON_ARGS="" SCRIPTNAME=/etc/init.d/$NAME +PID_FILE=/var/run/one/sunstone.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) + SUNSTONE_PID=`cat $PID_FILE` + kill -0 $SUNSTONE_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