From 8bd4acd531c958c8b06c3b8a72bb4038e477ef15 Mon Sep 17 00:00:00 2001 From: matthias Date: Wed, 13 May 2026 08:03:35 +0200 Subject: [PATCH] twaeaked nextcloud database script to run CP commands in ssh --- jenkins/nextcloud_database.yml | 11 +++++------ jenkins/other_location_backup.yml | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/jenkins/nextcloud_database.yml b/jenkins/nextcloud_database.yml index b5899e4..fc3910d 100644 --- a/jenkins/nextcloud_database.yml +++ b/jenkins/nextcloud_database.yml @@ -50,8 +50,8 @@ pipeline { steps { script { if (params.backuptodavid) { - sh "yes | cp -rf matthias@home.daf2000.nl:/media/disk/nextcloudbackup/database_dump/backup_yesterday.dmp matthias@home.daf2000.nl:/media/disk/nextcloudbackup/database_dump/backup_early.dmp 2>/dev/null || :" - sh "yes | cp -rf matthias@home.daf2000.nl:/media/disk/nextcloudbackup/database_dump/backup_latest.dmp matthias@home.daf2000.nl:/media/disk/nextcloudbackup/database_dump/backup_yesterday.dmp 2>/dev/null || :" + sh "ssh -p 664 matthias@home.daf2000.nl cp -rf /media/disk/nextcloudbackup/database_dump/backup_yesterday.dmp /media/disk/nextcloudbackup/database_dump/backup_early.dmp" + sh "ssh -p 664 matthias@home.daf2000.nl cp -rf /media/disk/nextcloudbackup/database_dump/backup_latest.dmp /media/disk/nextcloudbackup/database_dump/backup_yesterday.dmp" sh "rsync -v -a -e 'ssh -p 664' --delete --bwlimit=3000 --info=progress2 --exclude='.*' /srv/dev-disk-by-uuid-27fc012e-a1fa-4c7c-9dad-82770888cd03/nextcloud_backup/database_dump/ matthias@home.daf2000.nl:/media/disk/nextcloudbackup/database_dump/" } else { echo "Backup to David is skipped" @@ -63,10 +63,9 @@ pipeline { steps { script { if (params.backuptowinschoten) { - withCredentials([sshUserPrivateKey(credentialsId: 'backupwinschoten', keyFileVariable: 'keyfile', passphraseVariable: 'passphrase', usernameVariable: 'user')]) { - sh "cp ${keyfile} ${WORKSPACE}/keyfile" - sh "rsync -v -a -e 'ssh -i /home/backupwinschoten/.ssh/id_rsa -p 9897' --delete --info=progress2 ${env.borglocation}/${directory} backupwinschoten@localhost:/storage/borgbackups/" - } + sh "ssh -p 9897 backupwinschoten@localhost cp -rf /storage/nextcloud_backup/database_dump/backup_yesterday.dmp /storage/nextcloud_backup/database_dump/backup_early.dmp" + sh "ssh -p 9897 backupwinschoten@localhost cp -rf /storage/nextcloud_backup/database_dump/backup_latest.dmp /storage/nextcloud_backup/database_dump/backup_yesterday.dmp" + sh "rsync -v -a -e 'ssh -i /home/backupwinschoten/.ssh/id_rsa -p 9897' --delete --info=progress2 /storage/nextcloud_backup/database_dump/ backupwinschoten@localhost:/storage/borgbackups/" } else { echo "Backup to Winschoten is skipped" } diff --git a/jenkins/other_location_backup.yml b/jenkins/other_location_backup.yml index 96ed20e..fabec3d 100644 --- a/jenkins/other_location_backup.yml +++ b/jenkins/other_location_backup.yml @@ -26,6 +26,7 @@ pipeline { sh "borg create --progress --stats --exclude-from excludelist ${WORKSPACE}/tmpmount/${agentname}_${directory}::${java.time.LocalDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern('dd-MM-yyyy_HH:mm'))} /${directory}" sh "borg prune --list --keep-daily 31 --keep-weekly 48 ${WORKSPACE}/tmpmount/${agentname}_${directory}" } + } } }