Add backup script for hb

This commit is contained in:
Micke Nordin 2024-06-26 12:48:50 +02:00
parent 7f7d38c87e
commit 4cf8cf3adb
2 changed files with 17 additions and 0 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

@ -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}"