]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Add status argument that shows service status for all required services
authorJeff Peeler <jpeeler@redhat.com>
Fri, 11 May 2012 23:23:27 +0000 (19:23 -0400)
committerJeff Peeler <jpeeler@redhat.com>
Fri, 11 May 2012 23:24:57 +0000 (19:24 -0400)
Signed-off-by: Jeff Peeler <jpeeler@redhat.com>
tools/openstack

index ea6176781e29655ebd186a7d74cc69cdc035d7a5..032dd2bccb1622aef4ac4172dc133596b0ab0aaa 100755 (executable)
@@ -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."
        ;;