From 845a670f7d8b7e96db6491661bd4bdec06250520 Mon Sep 17 00:00:00 2001 From: Jeff Peeler Date: Fri, 11 May 2012 19:23:27 -0400 Subject: [PATCH] Add status argument that shows service status for all required services Signed-off-by: Jeff Peeler --- tools/openstack | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/openstack b/tools/openstack index ea61767..032dd2b 100755 --- a/tools/openstack +++ b/tools/openstack @@ -11,7 +11,7 @@ action=$1 if [ -z "$action" ] then - echo "openstack [start|stop|install|erase]" + echo "openstack [start|stop|install|erase|status]" echo "" echo "This tool is designed to control OpenStack on a Fedora 16/17 system" echo "" @@ -21,6 +21,16 @@ then echo "erase - permanently destroys an existing installation of OpenStack" fi +function os_status() { + services=(qpidd mysqld openstack-keystone tgtd openstack-glance-api openstack-glance-registry openstack-nova-api openstack-nova-objectstore openstack-nova-compute openstack-nova-network openstack-nova-volume openstack-nova-scheduler openstack-nova-cert) + for service in ${services[@]} + do + output=$(systemctl show "$service.service" --property=ActiveState) + running=(${output//=/ }) #ActiveState=active + echo "$service ${running[1]}" | awk '{ printf "%-40s %s\n", $1, $2}' + done +} + function os_start() { action=start sudo systemctl $action qpidd.service mysqld.service @@ -162,6 +172,9 @@ case $action in install) os_install ;; + status) + os_status + ;; *) echo "The action \"$action\" is not supported." ;;