Skip to content

Commit bf6f381

Browse files
committed
Fix running job as different user
Upstart is losing track of the process, when running from a wrapper script, created by the gradle application plugin (https://docs.gradle.org/current/userguide/application_plugin.html). Fixed as described in the upstart cookbook (http://upstart.ubuntu.com/cookbook/#run-a-job-as-a-different-user).
1 parent 20869c1 commit bf6f381

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

templates/service/upstart.conf.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
description "{{ deploy_service_description }}"
1818
author "https://github.com/acme-software/ansible-java-deployment"
19-
version 1.0.1
19+
version 1.0.2
2020

2121
# Respawn parameters with limit: dies 3 times within 60 seconds
2222
respawn
@@ -47,7 +47,7 @@ end script
4747
{% endif %}
4848

4949
# Execute deploy_service_start_command and log stdout
50-
exec su -s /bin/sh -c '{{ deploy_service_start_command }} {% if deploy_log_stdout == True %}1>>{{ deploy_log_stdout_path }}{% endif %} {% if deploy_log_stderr == True %}2>>{{ deploy_log_stderr_path }}{% endif %}' {{ deploy_app_user }}
50+
exec su -s /bin/sh -c 'exec "$0" "$@" {% if deploy_log_stdout == True %}1>>{{ deploy_log_stdout_path }}{% endif %} {% if deploy_log_stderr == True %}2>>{{ deploy_log_stderr_path }}{% endif %}' {{ deploy_app_user }} -- {{ deploy_service_start_command }} -b wibble
5151

5252
{% if deploy_service_has_prestop_script == True %}
5353
# Pre-Stop Script

0 commit comments

Comments
 (0)