(self)
Create the lockfile or raise a error if it exists.
Create the lockfile or raise a error if it exists.
Create the lockfile or raise a error if it exists .
def _do_lockfile_or_raise(self):
        """Create the lockfile or raise a error if it exists."""
        if (os.path.exists(self.lockfilename) and
                (os.path.getmtime(self.lockfilename) +
                    (self.lockfilegrace * 60) > time.time())):
            raise ISBGError(__exitcodes__['locked'],
                            "Lock file is present. Guessing isbg is " +
                            "already running. Exit.")
        else:
            lockfile = open(self.lockfilename, 'w')
            lockfile.write(repr(os.getpid()))
            lockfile.close()

            # Make sure to delete lock file
            atexit.register(self.removelock)
def _do_lockfile_or_raise ( self ) : if ( os . path . exists ( self . lockfilename ) and ( os . path . getmtime ( self . lockfilename ) + ( self . lockfilegrace * 60 ) > time . time ( ) ) ) : raise ISBGError ( __exitcodes__ [ 'locked' ] , "Lock file is present. Guessing isbg is " + "already running. Exit." ) else : lockfile = open ( self . lockfilename , 'w' ) lockfile . write ( repr ( os . getpid ( ) ) ) lockfile . close ( ) # Make sure to delete lock file atexit . register ( self . removelock )