ansible-development-environ.../roles/robertdebock.ara/templates/ara.j2

61 lines
930 B
Django/Jinja

#!/bin/sh
{{ ansible_managed | comment }}
#
# /etc/init.d/ara
#
# chkconfig: 2345 20 80
# description: Ansible Runtime Analyser
# Source function library.
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
fi
start() {
echo -n "Starting ara: "
returncode=$(daemon --user={{ ara_user }} ara-manage runserver > /dev/null 2>&1 &)
return ${returncode}
}
stop() {
echo -n "Shutting down ara: "
returncode=$(killall ara-manage)
return ${returncode}
}
status() {
returncode=$(pgrep ara > /dev/null 2>&1)
if [ "${returncode}" = 0 ] ; then
status=running
else
status=stopped
fi
echo "ara is ${status}"
return ${returncode}
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
start
;;
reload)
echo "not supported."
;;
*)
echo "Usage: <servicename> {start|stop|status|restart|reload}"
exit 1
;;
esac
exit $?