#!/usr/bin/env python from datetime import date from mreschke.serverbackups import Backups, cli, log # Configure logger log.init({ 'console': { 'level': 'INFO', # DEBUG, INFO, WARNING, ERROR, CRITICAL }, 'file': { 'enabled': True, 'file': '/tmp/backups-{}.log'.format(date.today().strftime('%Y-%m-%d')), } }) # Kill myself if already running cli.kill_if_running(__file__) # Set per server defaults. Each server can override parts of this default. defaults = { 'enabled': True, 'cluster': None, # Keep all daily up to X days back, last snapshot in a week X weeks back, last snapshot in a month X months back... 'prune': { 'keepDaily': 30, 'keepWeekly': 24, 'keepMonthly': 60, 'keepYearly': 10, },
from mreschke.serverbackups import Backups, cli, log # Configure logger log.init({ 'console': { 'level': 'DEBUG', }, 'file': { 'enabled': True, 'file': '/tmp/backups.log', } }) # Define each server to backup (each will be merged with defaults config) servers = { 'sunmac.mreschke.net': { 'enabled': True, 'cluster': 'localhost', 'source': { 'location': 'local', }, 'destination': { 'location': 'ssh', 'path': '/store/backups', 'ssh': { 'host': 'linstore.mreschke.net', 'user': '******', 'key': '/home/mreschke/.ssh/id_rsa' } }, 'backup': {
from datetime import date from mreschke.serverbackups import Backups, log from mreschke.serverbackups.utils import dump, dd # Optionally configure logger, but this app may have its own log settings log.init({ 'console': { 'level': 'DEBUG', }, 'file': { 'enabled': True, 'file': '/tmp/backups-{}.log'.format(date.today().strftime('%Y-%m-%d')), } }) # Set per server defaults defaults = { 'enabled': True, 'cluster': None, 'prune': { 'keepDaily': 30, 'keepWeekly': 24, 'keepMonthly': 60, 'keepYearly': 10, }, 'rsync': { 'verbose': True, }, 'source': { 'location': 'local', # local, ssh,