From d007c2e3c54a7012af1e2576e61200b7d4dd3918 Mon Sep 17 00:00:00 2001 From: lookshe Date: Tue, 28 Mar 2017 10:07:38 +0200 Subject: check return from borg init --- backup_db.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'backup_db.sh') diff --git a/backup_db.sh b/backup_db.sh index 90b9b72..5a951b0 100755 --- a/backup_db.sh +++ b/backup_db.sh @@ -67,6 +67,7 @@ function check_borg_repo { repo="$1" serverdir="$2" usesamerepo="$3" + ret=0 if [ "$usesamerepo" = "yes" ] then repo_path="$userserver:$backupdir/$serverdir" @@ -79,7 +80,13 @@ function check_borg_repo { then # create repo if not exists $nice $borg_local_path init --remote-path "$borg_remote_path" --encryption "$borg_encryption" "$repo_path" + if [ $? -ne 0 ] + then + $echo "problem in borg init $repo" + ret=1 + fi fi + return $ret } # backup single dir with borg @@ -87,7 +94,11 @@ function backup_db { repo="$1" serverdir="$2" usesamerepo="$3" - check_borg_repo "$repo" "$serverdir" "$usesamerepo" + check_borg_repo "$repo" "$serverdir" "$usesamerepo" + if [ $? -ne 0 ] + then + return 1 + fi # to get backup.ignore work with relative paths we need to change the directory if [ "$usesamerepo" = "yes" ] then -- cgit v1.2.3