Sync with https://bitbucket.org/PinIdea/zero-downtime-daemon