From 3306e4eb91ce5ad2e095bf7f7ed2d71f852e0889 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 28 Aug 2024 22:54:30 +0200 Subject: copyPhotos: erst markieren, dann hochladen --- copyPhotos | 78 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/copyPhotos b/copyPhotos index 026ac6b..992eebb 100755 --- a/copyPhotos +++ b/copyPhotos @@ -113,45 +113,6 @@ tar -cf - "${!jahre[@]}" --xform='s@^\([0-9]\{4\}\)_@\1/\1_@' | \ erg=0 -for ziel in "${ziele[@]}"; do - - host="${ziel%:*}" - verzeichnis="${ziel#*:}" - - pingErg=0 - - pingHost=$( - sed -n '/^Host '"${host#*@}"'$/,/^$/ { - s/^\s\+Hostname \(\S\+\)$/\1/ - T - p - }' ~/.ssh/config - ) - if [ -z "${pingHost}" ]; then - pingHost="${host#*@}" - fi - - ping -c1 "${pingHost}" > /dev/null || \ - pingErg=$? - - ! ${offline_erlaubt} && [ ${pingErg} -gt 1 ] && exit ${pingErg} - - if [ ${pingErg} -eq 0 ] - then - - rsync --progress --ignore-existing -avc "${tmp_dir}/" "${host}:${verzeichnis}/" - - echo "${summen}" | \ - sed 's@^\([0-9a-f]\+ \+\)\([0-9]\{4\}\)_@\1'"${verzeichnis}"'/\2/\2_@' | \ - ssh "${host}" 'sha512sum -c' - - fi - if [ ${pingErg} -gt ${erg} ]; then - erg=${pingErg} - fi - -done - while true do feh -XdF $(printf '%s\n' "${!jahre[@]}" | sort) @@ -233,6 +194,45 @@ do esac done +for ziel in "${ziele[@]}"; do + + host="${ziel%:*}" + verzeichnis="${ziel#*:}" + + pingErg=0 + + pingHost=$( + sed -n '/^Host '"${host#*@}"'$/,/^$/ { + s/^\s\+Hostname \(\S\+\)$/\1/ + T + p + }' ~/.ssh/config + ) + if [ -z "${pingHost}" ]; then + pingHost="${host#*@}" + fi + + ping -c1 "${pingHost}" > /dev/null || \ + pingErg=$? + + ! ${offline_erlaubt} && [ ${pingErg} -gt 1 ] && exit ${pingErg} + + if [ ${pingErg} -eq 0 ] + then + + rsync --progress --ignore-existing -avc "${tmp_dir}/" "${host}:${verzeichnis}/" + + echo "${summen}" | \ + sed 's@^\([0-9a-f]\+ \+\)\([0-9]\{4\}\)_@\1'"${verzeichnis}"'/\2/\2_@' | \ + ssh "${host}" 'sha512sum -c' + + fi + if [ ${pingErg} -gt ${erg} ]; then + erg=${pingErg} + fi + +done + if [ ${erg} -eq 0 ] then echo "${summen}" | \ -- cgit v1.2.3-70-g09d2