/srv/irclogs.ubuntu.com/2016/05/04/#upstart.txt

frewhey guys17:09
frewI'm using post-start to block until a service is ready17:09
frewI was under the impression that if a post-start script exits non-zero the service will then stop17:10
frewbut I guess that's not documented to be the case, and maybe it just isn't17:10
frewthoughts?17:10
chrasfrew: dont you want that in pre-start?17:31
frewuh18:15
frewno I don't see how that would make sense18:15
frewI want to run the main script, and then block till it's ready18:16
chrasmaybe im confused whatyou're trying to do18:17
frewyeah sorry18:17
frewso like18:17
frewimagine you have a web server18:17
frewand it takes like, 10s before it actually listens on port 8018:17
chrasbecuase you have some sort of ruby , or whatnot that takes time to do the initial compile?18:18
frewyou can add a post-start that wget's port 80 over and over till it gets an actual return18:18
frewright exactly18:18
frewthe problem is18:18
frewI'd like the post-start script, if it takes to long, to give up and mark the whole thing as failed18:18
chrasdoes something else trigger off of this event?18:20
frewwell18:30
frewif you do start $foo18:30
frewit will block until post-start completes18:30
frewso naive scripts do indeed18:30
chrasfrew: i just tested, and an exit code of 1 in a post-stop doesnt kill the already-running process18:31
chrasbut18:31
frewyeah I know; I just want it to :)18:31
chrasif you manually check18:32
chrasand issue a 'stop' inside your post-start18:32
chrasthen it will shut it down18:32
frewI thought I tried that18:33
frewhow do you do that?  I tried literally stop $svcname18:33
chrasso in my test i did this18:33
chraspost-start script echo "sysrqd: this is a post start the next line is a stop" | $ILOG stop18:33
chrasoop, formatting is wrong18:33
chrasill pastebin it18:33
chrashttps://pastebin.mozilla.org/886964018:33
frewok just a single stop.18:34
frewhuh18:34
chrasyeah18:34
frewany idea if that will make start exit non-zero?18:34
frewnot a huge deal but that would be nice18:34
chrasi think it just sends a term to the process18:34
chrasat least, thats what it appears to do18:35
frewright.18:35

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!