Avoid race condition with 1 second sleep.

Upstart will return from 'start xxx' immediately upon forking. We still
need to run start-stop-daemon, change users, exec again, and then run
the python code to get to listen() before the service is actually ready.
This all should take < 1s, but the sleep is just a stopgap until we have
a better way to track "is the service ready" in upstart.

Fixes bug #1179766

Change-Id: I3842e572c940e833cb3036b67df0ee71fe5bb129
This commit is contained in:
Clint Byrum 2013-05-14 08:39:25 -07:00
parent 49d54f5545
commit 567e8a0599
1 changed files with 3 additions and 0 deletions

View File

@ -20,6 +20,9 @@ end script
respawn
exec start-stop-daemon --start -c $user --exec /opt/stack/venvs/$user/bin/$cmd -- $args
# Help avoid race with daemon listening. http://pad.lv/1179766
post-start exec sleep 1
EOF
}