7
This commit is contained in:
@ -276,12 +276,18 @@ main() {
|
|||||||
log "Exporting configuration..."
|
log "Exporting configuration..."
|
||||||
export_config
|
export_config
|
||||||
|
|
||||||
|
# Test restic repository access
|
||||||
|
log "Testing repository access..."
|
||||||
|
if ! restic -r "${CONFIG[RESTIC_REPOSITORY]}" snapshots 2>&1 | tee -a "$BACKUP_LOG"; then
|
||||||
|
log "Error: Cannot access repository. Please check your credentials and repository URL."
|
||||||
|
backup_exit_code=1
|
||||||
|
else
|
||||||
# Run backup
|
# Run backup
|
||||||
log "Running backup..."
|
log "Running backup..."
|
||||||
log "Command: restic -r ${CONFIG[RESTIC_REPOSITORY]} backup ${CONFIG[BACKUP_PATH]}"
|
log "Command: restic -r ${CONFIG[RESTIC_REPOSITORY]} backup ${CONFIG[BACKUP_PATH]}"
|
||||||
|
|
||||||
# Run the backup command and capture both stdout and stderr
|
# Run the backup command and capture both stdout and stderr
|
||||||
if ! restic -r "${CONFIG[RESTIC_REPOSITORY]}" backup "${CONFIG[BACKUP_PATH]}" >> "$BACKUP_LOG" 2>&1; then
|
if ! restic -r "${CONFIG[RESTIC_REPOSITORY]}" backup "${CONFIG[BACKUP_PATH]}" 2>&1 | tee -a "$BACKUP_LOG"; then
|
||||||
log "Backup failed. Last few lines of the log:"
|
log "Backup failed. Last few lines of the log:"
|
||||||
tail -n 5 "$BACKUP_LOG" | while read -r line; do
|
tail -n 5 "$BACKUP_LOG" | while read -r line; do
|
||||||
log " $line"
|
log " $line"
|
||||||
@ -293,6 +299,7 @@ main() {
|
|||||||
# Add a small delay to ensure the snapshot is registered
|
# Add a small delay to ensure the snapshot is registered
|
||||||
sleep 2
|
sleep 2
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Get snapshot information
|
# Get snapshot information
|
||||||
log "Getting snapshot information..."
|
log "Getting snapshot information..."
|
||||||
|
Reference in New Issue
Block a user