diff options
| author | St33v <github@f3rr3t.com> | 2017-12-22 18:11:41 +1100 |
|---|---|---|
| committer | St33v <github@f3rr3t.com> | 2017-12-22 18:11:41 +1100 |
| commit | f280eeff40609a39b0b203633e9f1730d6638907 (patch) | |
| tree | 58162e9ff7c1f4794ad030f637ca7e1bbbb3933a | |
| parent | 31d0d55c1ac6a58c74dc6383cfa95fbe96a20747 (diff) | |
add robustness if rsync from Stan fails
| -rwxr-xr-x | rsync2eye.sh | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/rsync2eye.sh b/rsync2eye.sh index b665d62..80d136a 100755 --- a/rsync2eye.sh +++ b/rsync2eye.sh @@ -5,10 +5,27 @@ # Move files from Stan # https://logbuffer.wordpress.com/2011/03/24/linux-copy-only-certain-filetypes-with-rsync-from-foldertree/ + +thisyear=$(date +%Y) + src=st33v.ddns.net:/home/st33v/cams/ -dst=~/pix/ixus/2017/camz +dst=~/pix/ixus/${thisyear}/camz +if [ ! -d ${dst} ]; then + makedir -p ${dir} +fi +echo "$(date). Starting to move images from stan." +begin=$(date +"%s") rsync -a --remove-source-files --include='*/' --include='*.jpg' --exclude='*' -e "ssh -p 51337" $src $dst +if [ $? -ne 0 ]; then + echo "rsync from stan failed with exit code $? - exiting" + exit 1 +fi + +termin=$(date +"%s") +difftimelps=$(($termin-$begin)) +echo "$(($difftimelps / 60)) minutes and $(($difftimelps % 60)) seconds elapsed to copy from Stan." + # Is walrus mounted already? mountpoint -q /mnt/eye if [ $? -eq 1 ]; then @@ -21,13 +38,15 @@ if [ $? -ne 0 ]; then exit 1 fi -echo "Backing up pix to walrus." +echo "Starting at $(date). Backing up pix to walrus." -begin=$(date +"%s") +begin=$(date +"%s") rsync -a /mnt/dox/pix/* /mnt/eye #rsync -avn /mnt/dox/pix/* /mnt/eye termin=$(date +"%s") difftimelps=$(($termin-$begin)) -echo "$(($difftimelps / 60)) minutes and $(($difftimelps % 60)) seconds elapsed for Script Execution." + +echo "Finished at $(date)" +echo "$(($difftimelps / 60)) minutes and $(($difftimelps % 60)) seconds elapsed to copy to Walrus." |
