From 55b12cb7858ffe247900b7dbc804b945eb9911cd Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Fri, 1 Aug 2014 09:50:51 -0400 Subject: [PATCH] Fix up init script to use service command, preserve the worst return code and use that as the exit status --- tools/scripts/ansible-tower | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/scripts/ansible-tower b/tools/scripts/ansible-tower index dc33fb7d14..63cebcbfd6 100755 --- a/tools/scripts/ansible-tower +++ b/tools/scripts/ansible-tower @@ -26,10 +26,15 @@ fi service_action() { for svc in ${SERVICES[@]}; do - /etc/init.d/${svc} $1 + service ${svc} $1 + this_return=$? + if [ $this_return -gt $worst_return ]; then + worst_return=$this_return + fi done } +worst_return=0 case "$1" in start) echo "Starting Tower" @@ -51,3 +56,4 @@ case "$1" in *) echo "Usage: $0 {start|stop|restart|status}" esac +exit $worst_return