Borg Backup hang with a y/n question if a previously backup failed
Summary
If a borgbackup fail (for whatever reason) than the backup code rename the repo into borg_mysql_dbx_failed_xxxxxxx The backup code scans the directory for all borg_* files so it catches the failed backups too. Then borg hangs with the question
Warning: The repository at location /var/backup/web1/borg_mysql_c1dssdds_failed_682eee01c5cc3 was previously located at /var/backup/web1/borg_mysql_c1dssdds
Do you want to continue? [yN]
Steps to reproduce
debug enable
- do a manual backup in the interface
- do /usr/local/ispconfig/server/server.sh
- again (in the same minute) a manual backup in the interface in the same web
- again /usr/local/ispconfig/server/server.sh
- this should trigger a failed backup
- than again a backup in the web interface and after /usr/local/ispconfig/server/server.sh you see the borg question.
Correct behaviour
borg should ignore the failed repos
Environment
Ubuntu Noble Ispconfig 3.3 borgbackup 1.2.8
Proposed fix
diff --git a/server/lib/classes/backup.inc.php b/server/lib/classes/backup.inc.php
index cf4d9882b..d7e2f2237 100644
--- a/server/lib/classes/backup.inc.php
+++ b/server/lib/classes/backup.inc.php
@@ -1196,7 +1196,7 @@ class backup
switch ($backup_mode) {
case 'borg':
$repos_path = $backup_dir . '/' . $entry;
- if (is_dir($repos_path) && strncmp('borg_', $entry, 5) === 0) {
+ if (is_dir($repos_path) && strncmp('borg_', $entry, 5) === 0 && strpos($entry, '_failed_') === false) { //ignore failed borg archive
$repos_archives = self::getReposArchives($backup_mode, $repos_path, $password, 'json');
if(is_array($repos_archives)) {
$archivesJson = json_decode(implode("", $repos_archives), TRUE);
Edited by Hannes