Added some sshfs/ssh tuning, archive prunig added

This commit is contained in:
Charlie Root 2021-06-29 12:26:11 +02:00
parent cf19166215
commit 445c049cfe
2 changed files with 14 additions and 2 deletions

View File

@ -4,6 +4,9 @@ class wmdeit_backup::borg (
$repos = $borg_repos,
$scripts = $borg_scripts
)
inherits wmdeit_backup::params
@ -30,11 +33,16 @@ define wmdeit_backup::borg_backup
$ssh_user = 'root',
$ssh_port = '22',
$ssh_check_hostkey = 'no',
$borg_options = $wmdeit_backup::borg::borg_options,
$weekday = undef,
$hour = '0',
$minute = '0',
$retain_daily = '30',
$retain_monthly = '6',
$retain_yearly = '0',
) {
$scripts = $wmdeit_backup::borg::scripts
$repos = $wmdeit_backup::borg::repos
@ -66,10 +74,13 @@ export BORG_PASSPHRASE=$passphrase
D=`date +%F`
$wmdeit_backup::borg::sshfs_cmd $sshfs_options -oStrictHostKeyChecking=$ssh_check_hostkey -oPort=$ssh_port $ssh_user@$server:/ $mnt
cd $mnt
CMD=\"$borg_cmd create ${repo}::$title-\${D} $backup_dirs\"
CMD=\"$borg_cmd create $borg_options ${repo}::$title-\${D} $backup_dirs\"
\$CMD
cd /
umount $mnt
PRUNECMD=\"$borg_cmd prune -d $retain_daily -m $retain_monthly -y $retain_yearly ${repo}\"
\$PRUNECMD
"

View File

@ -12,7 +12,7 @@ class wmdeit_backup::params {
]
$sshfs_cmd = '/usr/local/bin/sshfs'
$sshfs_options = '-o direct_io' # buggy sshfs driver under freebsd
$sshfs_options = '-o reconnect -o direct_io' # buggy sshfs driver under freebsd
$borg_cmd = "/usr/local/bin/borg"
}
'Debian': {
@ -32,6 +32,7 @@ class wmdeit_backup::params {
$borg_repos = "/tank/backups"
$borg_scripts = "/root/borg"
$borg_mnt = "/mnt"
$borg_options = "--nobsdflags --files-cache=ctime,size"
}