mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
59 lines
1.2 KiB
Bash
Executable File
59 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# ansible-tower
|
|
#
|
|
# chkconfig: - 20 80
|
|
# description: support init to manage tower and its related services
|
|
|
|
### BEGIN INIT INFO
|
|
# Required-Start: $local_fs $remote_fs $network $named
|
|
# Required-Stop: $local_fs $remote_fs $network
|
|
# Should-Start: distcache
|
|
# 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
|
|
|
|
if [ -e /etc/debian_version ]
|
|
then
|
|
SERVICES=(postgresql rabbitmq-server apache2 supervisor)
|
|
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
|
|
done
|
|
}
|
|
|
|
worst_return=0
|
|
case "$1" in
|
|
start)
|
|
echo "Starting Tower"
|
|
service_action start
|
|
;;
|
|
stop)
|
|
echo "Stopping Tower"
|
|
service_action stop
|
|
;;
|
|
restart)
|
|
echo "Restarting Tower"
|
|
service_action stop
|
|
service_action start
|
|
;;
|
|
status)
|
|
echo "Showing Tower Status"
|
|
service_action status
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|status}"
|
|
esac
|
|
exit $worst_return
|