mirror of
https://github.com/ansible/awx.git
synced 2026-05-05 16:37:37 -02:30
Correct initscript order and mongod detection
In addition to starting and stopping mongod in the correct order, the check for determining whether mongod is required needs to happen when the service is managed.
This commit is contained in:
@@ -13,16 +13,29 @@ fi
|
|||||||
service_action() {
|
service_action() {
|
||||||
SERVICES=$TOWER_SERVICES
|
SERVICES=$TOWER_SERVICES
|
||||||
|
|
||||||
# Should MongoDB be managed by this script?
|
# When determining whether mongod is required, postgres is required. The
|
||||||
# We only manage MongoDB if the license uses it.
|
# following ensures mongod is started after postgres, and stopped before
|
||||||
tower-manage uses_mongo
|
# postgres.
|
||||||
if [ $? == 0 && ${1} == start ]; then
|
case ${1} in
|
||||||
SERVICES="$SERVICES mongod"
|
start|status)
|
||||||
elif [ $? == 0 && ${1} == stop ]; then
|
SERVICES="$SERVICES mongod"
|
||||||
SERVICES="mongod $SERVICES"
|
;;
|
||||||
fi
|
stop)
|
||||||
|
SERVICES="mongod $SERVICES"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
for svc in ${SERVICES}; do
|
for svc in ${SERVICES}; do
|
||||||
|
|
||||||
|
# Determine whether mongod is needed
|
||||||
|
if [[ ${svc} == mongod ]]; then
|
||||||
|
tower-manage uses_mongo 2> /dev/null >/dev/null
|
||||||
|
# if mongod is not required, break
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
service ${svc} $1
|
service ${svc} $1
|
||||||
this_return=$?
|
this_return=$?
|
||||||
if [ $this_return -gt $worst_return ]; then
|
if [ $this_return -gt $worst_return ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user