1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 09:51:09 +03:00
awx/tools/scripts/ansible-tower

60 lines
1.2 KiB
Plaintext
Raw Normal View History

2014-07-31 18:05:32 +04:00
#!/bin/bash
#
# ansible-tower
#
# chkconfig: - 20 80
# description: support init to manage tower and its related services
2014-07-30 21:18:42 +04:00
### BEGIN INIT INFO
# Provides:
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: support init to manage tower and its related services
# Description: Ansible Tower provides an easy-to-use UI and dashboard, role-based access control and more for your Ansible initiative
### END INIT INFO
2014-07-30 21:18:42 +04:00
if [ -e /etc/debian_version ]
then
2014-07-31 18:05:32 +04:00
SERVICES=(postgresql rabbitmq-server apache2 supervisor)
2014-07-30 21:18:42 +04:00
else
SERVICES=(postgresql rabbitmq-server httpd supervisord)
fi
service_action() {
for svc in ${SERVICES[@]}; do
service ${svc} $1
this_return=$?
if [ $this_return -gt $worst_return ]; then
worst_return=$this_return
fi
2014-07-30 21:18:42 +04:00
done
}
worst_return=0
2014-07-30 21:18:42 +04:00
case "$1" in
start)
echo "Starting Tower"
service_action start
;;
stop)
echo "Stopping Tower"
service_action stop
;;
restart)
echo "Restarting Tower"
2014-07-31 18:05:32 +04:00
service_action stop
service_action start
2014-07-30 21:18:42 +04:00
;;
status)
echo "Showing Tower Status"
service_action status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
2014-07-30 21:18:42 +04:00
esac
exit $worst_return