Last active
August 11, 2023 16:23
-
-
Save joshespi/b829c527b5f915c80dfa2330ae480b0f to your computer and use it in GitHub Desktop.
pcsd - pi device, ship backup folder to backup server.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
hs=$HOSTNAME | |
# Trap interrupts and exit instead of continuing the loop | |
trap "echo Exited!; exit;" SIGINT SIGTERM | |
MAX_RETRIES=10 | |
i=0 | |
# Set the initial return value to failure | |
false | |
while [ $? -ne 0 -a $i -lt $MAX_RETRIES ] | |
do | |
i=$(($i+1)) | |
#scp -r -l 5000 /home/pi/backup/ [email protected]:/home/tech/piBackups/"$hs"/ | |
rsync -avz --partial --progress /home/pi/backup/ [email protected]:/home/tech/piBackups/"$hs"/ | |
done | |
if [ $i -eq $MAX_RETRIES ] | |
then | |
logger "Hit maximum number of retries, ending." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
switched to rsync to help stop creating sub folders of subsequent backups at destination