(self)
return 0
Create lock file to deny other concurrent backups
Create lock file to deny other concurrent backups
Create lock file to deny other concurrent backups
def slave_lock_backups(self):
        """Create lock file to deny other concurrent backups"""
        srcdir = self.cf.getfile("completed_wals")
        lockfile = os.path.join(srcdir, "BACKUPLOCK")
        if os.path.isfile(lockfile):
            self.log.warning("Somebody already has the backup lock.")
            lockfilehandle = open(lockfile,"r")
            pidstring = lockfilehandle.read();
            try:
                pid = int(pidstring)
                print("%d" % pid)
            except ValueError:
                self.log.error("lock file does not contain a pid: %s", pidstring)
            return 1

        if not self.not_really:
            f = open(lockfile, "w")
            if len(self.args) > 0:
                f.write(self.args[0])
            f.close()
        self.log.info("Backup lock obtained.")
        return 0
def slave_lock_backups ( self ) : srcdir = self . cf . getfile ( "completed_wals" ) lockfile = os . path . join ( srcdir , "BACKUPLOCK" ) if os . path . isfile ( lockfile ) : self . log . warning ( "Somebody already has the backup lock." ) lockfilehandle = open ( lockfile , "r" ) pidstring = lockfilehandle . read ( ) try : pid = int ( pidstring ) print ( "%d" % pid ) except ValueError : self . log . error ( "lock file does not contain a pid: %s" , pidstring ) return 1 if not self . not_really : f = open ( lockfile , "w" ) if len ( self . args ) > 0 : f . write ( self . args [ 0 ] ) f . close ( ) self . log . info ( "Backup lock obtained." ) return 0