Skip to content

Retry connection #10

@Rexus

Description

@Rexus

Now when EL10 was released the mirror server has had issues actually retrieving the entire mirror.
After a few minutes the connection gets reset and only a few 10 of GB is transferred each time. To improve on this there should maybe be a retry function.

Example code:
`#!/bin/bash

ABOUT

Runs rsync, retrying on errors up to a maximum number of tries.

Simply edit the rsync line in the script to whatever parameters you need.

Trap interrupts and exit instead of continuing the loop

trap "echo Exited!; exit;" SIGINT SIGTERM

MAX_RETRIES=50
i=0

Set the initial return value to failure

false

while [ $? -ne 0 -a $i -lt $MAX_RETRIES ]
do
i=$(($i+1))
rsync -avz --progress --partial /rsync/source/folder backupuser@backup.destination.com:/rsync/destination/folder
done

if [ $i -eq $MAX_RETRIES ]
then
echo "Hit maximum number of retries, giving up."
fi`

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions