diff --git a/manifests/script.pp b/manifests/script.pp index b70c78d..fdabf30 100644 --- a/manifests/script.pp +++ b/manifests/script.pp @@ -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', diff --git a/templates/script/backup-hb.erb.sh b/templates/script/backup-hb.erb.sh new file mode 100755 index 0000000..706b589 --- /dev/null +++ b/templates/script/backup-hb.erb.sh @@ -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}"