Example #1
0
def cron(verbose=True):
    """ Run maintenance tasks
    """
    filename = os.path.join(barman.__config__.barman_home, '.cron.lock')
    with lockfile(filename) as locked:
        if not locked:
            raise SystemExit("ERROR: Another cron is running")
        else:
            servers = [Server(conf) for conf in barman.__config__.servers()]
            for server in servers:
                for lines in server.cron(verbose):
                    yield lines
Example #2
0
def cron(args):
    """ Run maintenance tasks
    """
    filename = os.path.join(barman.__config__.barman_home, '.cron.lock')
    with lockfile(filename) as locked:
        if not locked:
            yield "ERROR: Another cron is running"
            raise SystemExit, 1
        else:
            servers = [Server(conf) for conf in barman.__config__.servers()]
            for server in servers:
                for lines in server.cron(verbose=True):
                    yield lines
Example #3
0
 def xlogdb(self, mode='r'):
     if not os.path.exists(self.config.wals_directory):
         os.makedirs(self.config.wals_directory)
     xlogdb = os.path.join(self.config.wals_directory, self.XLOG_DB)
     # If the file doesn't exist and it is required to read it,
     # we open it in a+ mode, to be sure it will be created
     if not os.path.exists(xlogdb) and mode.startswith('r'):
         if '+' not in mode:
             mode = "a%s+" % mode[1:]
         else:
             mode = "a%s" % mode[1:]
     xlogdb_lock = xlogdb + ".lock"
     with lockfile(xlogdb_lock, wait=True):
         with open(xlogdb, mode) as f:
             yield f
Example #4
0
 def xlogdb(self, mode='r'):
     if not os.path.exists(self.config.wals_directory):
         os.makedirs(self.config.wals_directory)
     xlogdb = os.path.join(self.config.wals_directory, self.XLOG_DB)
     # If the file doesn't exist and it is required to read it,
     # we open it in a+ mode, to be sure it will be created
     if not os.path.exists(xlogdb) and mode.startswith('r'):
         if '+' not in mode:
             mode = "a%s+" % mode[1:]
         else:
             mode = "a%s" % mode[1:]
     xlogdb_lock = xlogdb + ".lock"
     with lockfile(xlogdb_lock, wait=True):
         with open(xlogdb, mode) as f:
             yield f