start on runlevel [2345]
stop on runlevel [!2345]

script
        test -f /etc/default/locale && . /etc/default/locale || true
        export LANG
        exec start-stop-daemon --start -c jenkins --exec /usr/bin/java \
                --name jenkins-agent --  -jar <%= @swarm_client_dest %> \
                -username jenkins_agent -password <%= @agent_user_api_token %> \
                -name <%= @hostname %> -executors <%= @executors %> \
                -master https://<%= @ci_master %>/ \
                -fsroot <%= @fsroot %> -labels '<%= @labels %>'
end script

start on runlevel [2345]
stop on runlevel [!2345]

respawn
respawn limit 5 20

script
        test -f /etc/default/locale && . /etc/default/locale || true
        export LANG
        exec start-stop-daemon --start -c jenkins --exec /usr/bin/java \
                --name jenkins-agent --  -jar <%= @swarm_client_dest %> \
                -username jenkins_agent -password <%= @agent_user_api_token %> \
                -name <%= @hostname %> -executors <%= @executors %> \
                -master https://<%= @ci_master %>/ \
                -fsroot <%= @fsroot %> -labels '<%= @labels %>'
end script

Add respawn to jenkins-agent upstart
Add respawn to jenkins-agent upstart

We should try restarting the service if it crashes before the CI master
determines that is unable to connect to it.
