Issues with post-start stopping

Jens Rantil jens.rantil at tink.se
Thu Mar 20 17:41:03 UTC 2014


Hi,

I have an HTTP server daemon process that I start using upstart. When I
start it I'd like it to wait for at most 60 seconds for an HTTP check to
return 200. If it doesn't return within 60 I'd like to fail "start myapp",
otherwise I'd like to return "start myapp" as soon as I get a correct HTTP
response.

I've been trying to use

post-start script
  /bin/my-healthcheck --max-wait 60
  if [ $? -ne 0 ]; then
    stop
    exit 1
  fi
end script

But "stop; exit 1" doesn't seem to stop my service.

Can this be done using upstart? Or will I need to `exec myservice_safe`
that initiates a check and my main script? Or use events?

Thanks,
Jens

PS. I've cross posted my question here:
https://serverfault.com/questions/583426/why-is-this-upstart-script-not-stopping-my-process
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/upstart-devel/attachments/20140320/bbca71c5/attachment.html>


More information about the upstart-devel mailing list