def run(self):
        """ run daemon """
        # FIXME - not detaching doesn't work, just run directly for now
        # self._exec(detach=False)
        try:
            with self.pidfile:
                return self._main()

        except pidfile.PidFileError:
            # this isn't exposed in pidfile :o
            self.log.error("failed to get pid lock, already running?")
            return 1

        finally:
            # call on_stop to let them clean up
            for mod in self.joins:
                self.log.debug("stopping %s", mod.name)
                mod.on_stop()
def run ( self ) : try : with self . pidfile : return self . _main ( ) except pidfile . PidFileError : self . log . error ( "failed to get pid lock, already running?" ) return 1 finally : for mod in self . joins : self . log . debug ( "stopping %s" , mod . name ) mod . on_stop ( )
run daemon