def start(self):
        """
        Start the daemon
        """
        # Check for a pidfile to see if the daemon already runs
        logger.info('Starting daemon')
        try:
            with open(self.pidfile, 'r') as fd:
                pid = int(fd.read().strip())
        except IOError:
            pid = None

        if pid:
            message = "pidfile %s already exist. Daemon already running?\n"
            sys.stderr.write(message % self.pidfile)
            sys.exit(1)

        # Start the daemon
        pid = self.daemonize()
        if pid:
            return pid
        self.run()
def start ( self ) : logger . info ( 'Starting daemon' ) try : with open ( self . pidfile , 'r' ) as fd : pid = int ( fd . read ( ) . strip ( ) ) except IOError : pid = None if pid : message = "pidfile %s already exist. Daemon already running?\n" sys . stderr . write ( message % self . pidfile ) sys . exit ( 1 ) pid = self . daemonize ( ) if pid : return pid self . run ( )
Start the daemon