Compare commits

...

2 commits

Author SHA1 Message Date
Micke Nordin d696c19242 Add backup script for hb 2024-06-26 12:51:24 +02:00
Micke Nordin eef539928e Switch logic 2024-06-26 12:51:24 +02:00
3 changed files with 18 additions and 1 deletions

View file

@ -97,6 +97,10 @@ class sunetdrive::script (
unless => "python3 -m pip list | grep drive-utils | grep ${drive_version}",
require => Package['python3'],
}
file { '/opt/backups/scripts':
ensure => directory,
mode => '0700'
}
file { '/root/.ssh/':
ensure => directory,
mode => '0700',
@ -335,6 +339,13 @@ class sunetdrive::script (
group => 'root',
mode => '0700',
}
file { '/opt/backups/scripts/hb.sh':
ensure => file,
content => template('sunetdrive/script/backup-hb.erb.sh'),
owner => 'root',
group => 'root',
mode => '0700',
}
sunet::scriptherder::cronjob { 'backupmultinodedb':
cmd => '/root/tasks/backupmultinodedb.sh',
hour => '2',

View file

@ -50,7 +50,7 @@ function do_backup {
rclone mount ${project}:${bucket} ${mountpoint}/ --daemon --allow-other --dir-cache-time 24h
rclone mkdir ${mirror}:${mirrorbucket}
duplicity --full-if-older-than 1M --asynchronous-upload --tempdir /mnt --archive-dir /mnt --no-encryption ${mountpoint} rclone://${mirror}:/${mirrorbucket}
if [[ "${extra_backup_jobs[${customer}]:+none}" != "none" ]] && [[ -f "${extra_backup_jobs[${customer}]}" ]]; then
if [[ "${extra_backup_jobs[${customer}]:+found}" == "found" ]] && [[ -f "${extra_backup_jobs[${customer}]}" ]]; then
${extra_backup_jobs[${customer}]}
fi
umount ${mountpoint}

View file

@ -0,0 +1,6 @@
#!/bin/bash
environ="prod"
if [[ $(hostname -d) == "drive.test.sunet.se" ]]; then
environ="test"
fi
rsync -e "ssh -i ${HOME}/.ssh/id_script" -avz /opt/backupmounts/ "sd-${environ}@sd-${environ}-backup.hb.se:~/sd-${environ}"