|
|
|
@ -3,10 +3,6 @@
|
|
|
|
|
class wmdeit_backup::borg (
|
|
|
|
|
$repos = $borg_repos,
|
|
|
|
|
$scripts = $borg_scripts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
inherits wmdeit_backup::params
|
|
|
|
@ -42,6 +38,10 @@ define wmdeit_backup::borg_backup
|
|
|
|
|
$retain_daily = '30',
|
|
|
|
|
$retain_monthly = '6',
|
|
|
|
|
$retain_yearly = '0',
|
|
|
|
|
|
|
|
|
|
$retry_count = 3,
|
|
|
|
|
$statistics = true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
$scripts = $wmdeit_backup::borg::scripts
|
|
|
|
@ -53,6 +53,12 @@ define wmdeit_backup::borg_backup
|
|
|
|
|
|
|
|
|
|
$repo = "$repos/$title"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if $statistics {
|
|
|
|
|
$time_cmd = '/usr/bin/time'
|
|
|
|
|
$borg_statistics = '-s'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exec {"borg_init_$title":
|
|
|
|
|
command => "/bin/sh -c 'export BORG_PASSPHRASE=$passphrase && $borg_cmd init -e $encryption $repo'",
|
|
|
|
|
unless => "/bin/sh -c 'export BORG_PASSPHRASE=$passphrase && $borg_cmd list -e $encryption $repo'",
|
|
|
|
@ -74,8 +80,15 @@ 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 $borg_options ${repo}::$title-\${D} $backup_dirs\"
|
|
|
|
|
\$CMD
|
|
|
|
|
CMD=\"$borg_cmd create $borg_statistics --checkpoint-interval 600 $borg_options ${repo}::$title-\${D} $backup_dirs\"
|
|
|
|
|
n=0
|
|
|
|
|
until [ \"\$n\" -ge $retry_count ]
|
|
|
|
|
do
|
|
|
|
|
\$CMD && break
|
|
|
|
|
n=\$((n+1))
|
|
|
|
|
sleep 1
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
cd /
|
|
|
|
|
umount $mnt
|
|
|
|
|
PRUNECMD=\"$borg_cmd prune -d $retain_daily -m $retain_monthly -y $retain_yearly ${repo}\"
|
|
|
|
@ -89,7 +102,7 @@ PRUNECMD=\"$borg_cmd prune -d $retain_daily -m $retain_monthly -y $retain_yearly
|
|
|
|
|
weekday => $weekday,
|
|
|
|
|
hour => $hour,
|
|
|
|
|
minute => $minute,
|
|
|
|
|
command => "/bin/sh $script_name"
|
|
|
|
|
command => "$time_cmd /bin/sh $script_name"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|