I've also added two lines to protect the killing part, which I did not mention above. Don't know whether it's useful or not.
By the end of pre-start: initctl set-env --global SSH_AGENT_LAUNCHER=/usr/share/upstart/sessions/ssh-agent.conf
By the beginning of post-stop: [ "$SSH_AGENT_LAUNCHER" = /usr/share/upstart/sessions/ssh-agent.conf ] || exit 0
I've also added two lines to protect the killing part, which I did not mention above. Don't know whether it's useful or not.
By the end of pre-start: LAUNCHER= /usr/share/ upstart/ sessions/ ssh-agent. conf
initctl set-env --global SSH_AGENT_
By the beginning of post-stop: LAUNCHER" = /usr/share/ upstart/ sessions/ ssh-agent. conf ] || exit 0
[ "$SSH_AGENT_