From 9a74961bafabc404f015fc5d8a9da969d263dad3 Mon Sep 17 00:00:00 2001 From: Amy Fong Date: Mon, 17 Mar 2014 14:14:48 -0400 Subject: OpenStack: Add to missing functionality in sysvinit scripts Add status/reload to sysvinit scripts Modify tgtd to make start/stop work better (borrowed from Debian's implementation) Signed-off-by: Amy Fong Signed-off-by: Bruce Ashfield --- .../recipes-devtools/python/python-nova/nova-all | 19 +++++++++++++++++-- .../python/python-nova/nova-consoleauth | 19 ++++++++++++++++--- .../python/python-nova/nova-novncproxy | 19 ++++++++++++++++--- .../recipes-devtools/python/python-nova/nova.init | 19 +++++++++++++++++-- 4 files changed, 66 insertions(+), 10 deletions(-) (limited to 'meta-openstack/recipes-devtools/python/python-nova') diff --git a/meta-openstack/recipes-devtools/python/python-nova/nova-all b/meta-openstack/recipes-devtools/python/python-nova/nova-all index 5891759..b3ff40e 100644 --- a/meta-openstack/recipes-devtools/python/python-nova/nova-all +++ b/meta-openstack/recipes-devtools/python/python-nova/nova-all @@ -53,6 +53,18 @@ stop () rm -f $PIDFILE } +status() +{ + pid=`cat $PIDFILE 2>/dev/null` + if [ -n "$pid" ]; then + if ps -p $pid >&- ; then + echo "$DESC is running" + return + fi + fi + echo "$DESC is not running" +} + case "$1" in start) start @@ -60,12 +72,15 @@ case "$1" in stop) stop ;; - restart|force-reload) + restart|force-reload|reload) stop start ;; + status) + status + ;; *) - echo "Usage: $0 {start|stop|force-reload|restart}" + echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" exit 1 ;; esac diff --git a/meta-openstack/recipes-devtools/python/python-nova/nova-consoleauth b/meta-openstack/recipes-devtools/python/python-nova/nova-consoleauth index 13ad285..56561db 100644 --- a/meta-openstack/recipes-devtools/python/python-nova/nova-consoleauth +++ b/meta-openstack/recipes-devtools/python/python-nova/nova-consoleauth @@ -43,6 +43,19 @@ if ! [ -x ${DAEMON} ] ; then exit 0 fi +DESC="nova console" +status() +{ + pid=`cat $PIDFILE 2>/dev/null` + if [ -n "$pid" ]; then + if ps -p $pid >&- ; then + echo "$DESC is running" + return + fi + fi + echo "$DESC is not running" +} + case "$1" in start) test "$ENABLED" = "true" || exit 0 @@ -56,7 +69,7 @@ case "$1" in start-stop-daemon --stop --oknodo --pidfile ${PIDFILE} log_end_msg $? ;; - restart|force-reload) + restart|force-reload|reload) test "$ENABLED" = "true" || exit 1 $0 stop sleep 1 @@ -64,10 +77,10 @@ case "$1" in ;; status) test "$ENABLED" = "true" || exit 0 - status_of_proc -p $PIDFILE $DAEMON nova-consoleauth && exit 0 || exit $? + status ;; *) - echo "Usage: /etc/init.d/nova-consoleauth {start|stop|restart|force-reload|status}" + echo "Usage: /etc/init.d/nova-consoleauth {start|stop|restart|force-reload|status|reload|status}" exit 1 ;; esac diff --git a/meta-openstack/recipes-devtools/python/python-nova/nova-novncproxy b/meta-openstack/recipes-devtools/python/python-nova/nova-novncproxy index 76cd1df..c976194 100644 --- a/meta-openstack/recipes-devtools/python/python-nova/nova-novncproxy +++ b/meta-openstack/recipes-devtools/python/python-nova/nova-novncproxy @@ -40,6 +40,19 @@ if ! [ -x ${DAEMON} ] ; then exit 0 fi +DESC="nova vnc proxy" +status() +{ + pid=`cat $PIDFILE 2>/dev/null` + if [ -n "$pid" ]; then + if ps -p $pid >&- ; then + echo "$DESC is running" + return + fi + fi + echo "$DESC is not running" +} + case "$1" in start) test "$ENABLED" = "true" || exit 0 @@ -53,7 +66,7 @@ case "$1" in start-stop-daemon --stop --oknodo --pidfile ${PIDFILE} log_end_msg $? ;; - restart|force-reload) + restart|force-reload|reload) test "$ENABLED" = "true" || exit 1 $0 stop sleep 1 @@ -61,10 +74,10 @@ case "$1" in ;; status) test "$ENABLED" = "true" || exit 0 - status_of_proc -p $PIDFILE $DAEMON nova-novncproxy && exit 0 || exit $? + status ;; *) - echo "Usage: /etc/init.d/nova-novncproxy {start|stop|restart|force-reload|status}" + echo "Usage: /etc/init.d/nova-novncproxy {start|stop|restart|force-reload|status|reload|status}" exit 1 ;; esac diff --git a/meta-openstack/recipes-devtools/python/python-nova/nova.init b/meta-openstack/recipes-devtools/python/python-nova/nova.init index c317f84..5d298fd 100644 --- a/meta-openstack/recipes-devtools/python/python-nova/nova.init +++ b/meta-openstack/recipes-devtools/python/python-nova/nova.init @@ -57,6 +57,18 @@ stop () rm -f $PIDFILE } +status() +{ + pid=`cat $PIDFILE 2>/dev/null` + if [ -n "$pid" ]; then + if ps -p $pid >&- ; then + echo "$DESC is running" + return + fi + fi + echo "$DESC is not running" +} + case "$1" in start) start @@ -64,12 +76,15 @@ case "$1" in stop) stop ;; - restart|force-reload) + restart|force-reload|reload) stop start ;; + status) + status + ;; *) - echo "Usage: $0 {start|stop|force-reload|restart}" + echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" exit 1 ;; esac -- cgit v1.2.3-54-g00ecf