openstack-ansible/playbooks/roles/os_swift/templates/swift-upstart-init.j2
git-harry 8cbc495deb Fix spelling of runlevel in init scripts
A number of the init templates in the OpenStack roles have the word
runlevel incorrectly spelt as runlelvl. This commit correct those
spelling mistakes.

Change-Id: I0d1b7d5c5cf088fecf07cf0e1bd676b4e4088e2b
Closes-bug: #1464603
2015-06-13 10:21:17 +01:00

43 lines
1.5 KiB
Django/Jinja

# {{ ansible_managed }}
{% if (swift.replication_network is not defined or swift.replication_network == swift.storage_network) and 'replicator-server' in program_name %}
# Blank script - dedicated replication network not in use
{% else %}
# vim:set ft=upstart ts=2 et:
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="/usr/local/bin/{{ program_binary | default(program_name) }}"
# Change directory to service users home
chdir "{{ service_home }}"
# Pre start actions
pre-start script
mkdir -p "/var/run/{{ program_binary | default(program_name) }}"
chown {{ system_user }}:{{ system_group }} "/var/run/{{ program_binary | default(program_name) }}"
mkdir -p "/var/lock/{{ program_binary | default(program_name) }}"
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_binary | default(program_name) }}"
end script
# Post stop actions
post-stop script
rm "/var/run/{{ program_binary | default(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_binary | default(program_name) }}/{{ program_name }}.pid \
--exec "{{ program_override|default('$RUNBIN') }}" "{{ program_config_options|default('') }}"
{% endif %}