diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index f7ce1912..ddf32f75 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -97,7 +97,7 @@ class Arbiter(object): self.pidfile.create(self.pid) self.log.info("Arbiter booted") self.log.info("Listening at: %s" % self.LISTENER) - + self.cfg.when_ready(self) def init_signals(self): """\ diff --git a/gunicorn/config.py b/gunicorn/config.py index aa306dc3..6febbe24 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -536,3 +536,17 @@ with Setting("pre_exec") as s: The callable needs to accept a single instance variable for the Arbiter. """) + + +with Setting("when_ready") as s: + s.section = "Server Hooks" + s.validator = validate_callable(1) + s.type = "callable" + def def_start_server(server): + pass + s.default = def_start_server + s.fmt_desc("""\ + Called just after the server is started + + The callable needs to accept a single instance variable for the Arbiter. + """)