Skip to content

Commit

Permalink
turns out to be nice to use ginkgoctl on services running in the fore…
Browse files Browse the repository at this point in the history
…ground with ginkgo, so we'll always create a pidfile unless explicitly set to False
  • Loading branch information
progrium committed Apr 28, 2012
1 parent 41ab7b5 commit 0aab84a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ginkgo/runner.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def __init__(self, app_factory, config=None):
self.config = config or ginkgo.settings self.config = config or ginkgo.settings
self.logger = ginkgo.logger.Logger(self) self.logger = ginkgo.logger.Logger(self)


if self.daemon: if self.pidfile is not False:
if self.pidfile is None: if self.pidfile is None:
self.config.set("pidfile", self.config.set("pidfile",
"/tmp/{}.pid".format(self.service_name)) "/tmp/{}.pid".format(self.service_name))
Expand Down Expand Up @@ -241,9 +241,11 @@ def do_start(self):
ginkgo.util.prevent_core_dump() ginkgo.util.prevent_core_dump()
ginkgo.util.daemonize( ginkgo.util.daemonize(
preserve_fds=self.logger.file_descriptors) preserve_fds=self.logger.file_descriptors)
self.logger.capture_stdio()
self.pid = os.getpid() self.pid = os.getpid()

if self.pidfile:
self.pidfile.create(self.pid) self.pidfile.create(self.pid)
self.logger.capture_stdio()


if self.umask is not None: if self.umask is not None:
os.umask(self.umask) os.umask(self.umask)
Expand Down Expand Up @@ -278,7 +280,7 @@ def post_start(self):
def do_stop(self): def do_stop(self):
logger.info("Stopping.") logger.info("Stopping.")
self.logger.shutdown() self.logger.shutdown()
if self.daemon: if self.pidfile:
self.pidfile.unlink() self.pidfile.unlink()


def do_reload(self): def do_reload(self):
Expand Down

0 comments on commit 0aab84a

Please sign in to comment.