Created
January 31, 2017 23:52
-
-
Save ronggong/16606f53c2a2d28ed677b00e23e4913a to your computer and use it in GitHub Desktop.
rsync, get data into cluster
This file contains 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 | |
### 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. | |
### This bash should be originaly written by Sergio Oramas, originaly posted on HPC page of MTG-services Wiki | |
# 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 -P --append -e "ssh -T -c arcfour -o Compression=no -x" yourfile.tar.gz hpc.dtic.upf.edu:yourfolder/ | |
done | |
if [ $i -eq $MAX_RETRIES ] | |
then | |
echo "Hit maximum number of retries, giving up." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment