description "Girder server"

start on startup
stop on shutdown

# Automatically Respawn:
respawn
respawn limit 20 5

setuid "{{ girder_user | default(ansible_user_id) }}"
setgid "{{ girder_user | default(ansible_user_id) }}"

script
    cd "{{ girder_path }}"
    {% if girder_virtualenv is defined %}
    . "{{ girder_virtualenv }}/bin/activate" && python -m girder
    {% else %}
    exec "{{ girder_python | default(ansible_python.executable) }}" -m girder
    {% endif %}
end script
