-
Notifications
You must be signed in to change notification settings - Fork 13
/
config.cfg.example
87 lines (69 loc) · 3.76 KB
/
config.cfg.example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# -*- mode: python -*-
# example configuration file for dupinanny:
# this is evaluated as python code.
# you can import modules, declare classes, do all the usual python things
# dupinnany will work from the 'DupiConfig' dictionary you setup
DupiConfig = {}
#########################################
# general options:
#########################################
config = {
'lockfile' : 'lockfile_path', # where to store the lock/pid file
'password' : 'mypass', # password for PGP (use --no-encryption in duplicity_args if you do not wish to encrypt)
# 'dry_run' : True, # optional, can also use --dry-run on command line
# 'duplicity' : 'duplicity', # optional, path to duplicity script
# 'backup_every' : 7, # optional, really do a backup every n days only (keep retrying on every invocation until operation is successful)
# 'remove_older' : 4, # optional, remove backups older than n days (4 by default, set to 0 to disable)
# 'tempdir' : '/alternate/tmp', # optional, alternate temporary storage directory
# 'duplicity_args' : [ '--s3-use-new-style' ], # optional, extra arguments to use when calling duplicity (this example in particular may be needed when using S3)
}
#########################################
# backup targets:
#########################################
# this shows how to breakdown a backup over rsync into multiple independent pieces
# we also show how to exclude some paths, there is also an include option available
destination_root = 'rsync://@my_host::my_backup_path'
# S3 NOTE - use the following:
# destination_root = 's3+http://my_bucket_name'
# don't use --s3-use-new-style
from backup import BackupTarget
DupiConfig['items'] = [
BackupTarget( root = '/', destination = destination_root, exclude = [ '/usr/local/games' ], shortFilenames = True ),
# (dupinanny calls duplicity with --exclude-other-filesystems, so you may need to add more)
BackupTarget( root = '/var', destination = '%s/var' % destination_root, shortFilenames = True ),
]
#########################################
# LVM support (EXPERIMENTAL):
#########################################
# if you use LVM, you can use LVM snapshots to make sure you're backing up a consistent image
# use LVMBackupTarget for that purpose, you need a path to mount the snapshot to, and that's what you use as the root of the backup
# you also need to pass the name of the snapshot LVM volume that is created, the LVM path for it, and it's size
DupiConfig['items'].append(
LVMBackupTarget( root = '/mnt/dupinanny', destination = 'rsync://@my_host::my_lvm_backup_path', lvmpath = '/dev/lvmvolume/volumename', snapsize = '20G', snapshot_name = 'dupinanny', snapshot_path = '/dev/lvmvolume/dupinanny' )
)
#########################################
# optional stuff:
#########################################
# define your backup class if you need to override it
# by default the system will instanciate the main class for you
#from backup import Backup
#DupiConfig['backup'] = Backup( DupiConfig )
# adding pre-backup steps - write your own class, or use some of the provided utilities
# for instance, this checks that a particular filesystem is mounted
#from backup import CheckMount
#DupiConfig['prepare'] = [ CheckMount( '/mnt/backup' ) ]
# adding post-backup steps - write your own class, or use some of the provided utilities
# for instance, this displays the disk usage
#class SFTPDiskSpace( object ):
# def __init__( self, server ):
# self.server = server
#
# def Posthook( self, backup ):
# print 'SFTPDiskSpace.Posthook'
# cmd = 'echo df -h | sftp "%s"' % self.server
# print cmd
# p = subprocess.Popen( cmd, stdin = None, shell = True )
# p.wait()
#
#DupiConfig['posthook'] = [ SFTPDiskSpace('user@server') ]
DupiConfig['config'] = config