openstack-ansible-os_nova/templates/nova-upstart-init.j2
You Wei Wang fe8d516b76 Trivial: Remove vim header from source files
Change-Id: I68a7d910d45ef5bbbc8b59d9bc363fa68c6a8663
2016-01-14 10:52:17 +00:00

45 lines
1.2 KiB
Django/Jinja

# {{ ansible_managed }}
description "{{ program_name }}"
author "Kevin Carter <kevin.carter@rackspace.com>"
start on runlevel [2345]
stop on runlevel [016]
respawn
respawn limit 10 5
# Set the RUNBIN environment variable
env RUNBIN="{{ nova_bin }}/{{ program_name }}"
# Change directory to service users home
chdir "{{ service_home }}"
# Pre start actions
pre-start script
mkdir -p "/var/run/{{ program_name }}"
chown {{ system_user }}:{{ system_group }} "/var/run/{{ program_name }}"
mkdir -p "/var/lock/{{ program_name }}"
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_name }}"
{% if nova_venv_enabled | bool -%}
. {{ nova_venv_bin }}/activate
{%- endif %}
end script
# Post stop actions
post-stop script
rm "/var/run/{{ program_name }}/{{ program_name }}.pid"
end script
# Run the start up job
exec start-stop-daemon --start \
--chuid {{ system_user }} \
--make-pidfile \
--pidfile /var/run/{{ program_name }}/{{ program_name }}.pid \
--exec "{{ program_override|default('$RUNBIN') }}" \
-- {{ program_config_options|default('') }} \
--log-file=/var/log/nova/{{ program_name }}.log