Add support for restarting a service 91/56491/8
authorDimitrios Markou <mardim@intracom-telecom.com>
Wed, 25 Apr 2018 14:37:03 +0000 (17:37 +0300)
committerDimitrios Markou <mardim@intracom-telecom.com>
Thu, 3 May 2018 08:44:23 +0000 (11:44 +0300)
JIRA: YARDSTICK-1138

Change-Id: Id57defb574eb7e0f5be81b52803cdb05f46796ab
Signed-off-by: Dimitrios Markou <mardim@intracom-telecom.com>
yardstick/benchmark/scenarios/availability/ha_tools/start_service.bash

index 858d86c..1d0fffd 100755 (executable)
@@ -9,11 +9,12 @@
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
 
-# Start a service and check the service is started
+# Start or restart a service and check the service is started
 
 set -e
 
 service_name=$1
+operation=${2-start} # values are "start" or "restart"
 
 Distributor=$(lsb_release -a | grep "Distributor ID" | awk '{print $3}')
 
@@ -26,7 +27,7 @@ elif [ "$service_name" = "keystone" ]; then
 fi
 
 if which systemctl 2>/dev/null; then
-    systemctl start $service_name
+    systemctl $operation $service_name
 else
-    service $service_name start
+    service $service_name $operation
 fi