Update mirrorsync.sh

Removed calling rsync by explicit path
This commit is contained in:
Dennis Körner 2021-06-03 12:40:08 +02:00 committed by GitHub
parent cddbf9fc58
commit 343a2269b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,6 @@
# #
rsync="/usr/bin/rsync"
# You can change v to q if you do not want detailed logging # You can change v to q if you do not want detailed logging
opts=(-vrlptDSH --exclude="*.~tmp~" --delete-delay --delay-updates) opts=(-vrlptDSH --exclude="*.~tmp~" --delete-delay --delay-updates)
@ -55,7 +54,7 @@ logfile="$0.log"
# Check if the filelistfile has changed on upstream mirror # Check if the filelistfile has changed on upstream mirror
# and exit if it is still the same # and exit if it is still the same
checkresult=$(${rsync} --no-motd --dry-run --out-format="%n" "${src}/${filelistfile}" "${dst}/${filelistfile}") checkresult=$(rsync --no-motd --dry-run --out-format="%n" "${src}/${filelistfile}" "${dst}/${filelistfile}")
if [[ -z "$checkresult" ]]; then if [[ -z "$checkresult" ]]; then
printf "%s unchanged. Not updating at %(%c)T\n" "$filelistfile" -1 >> "$logfile" 2>&1 printf "%s unchanged. Not updating at %(%c)T\n" "$filelistfile" -1 >> "$logfile" 2>&1
logger -t rsync "Not updating ${mirrormodule}: ${filelistfile} unchanged." logger -t rsync "Not updating ${mirrormodule}: ${filelistfile} unchanged."
@ -78,8 +77,7 @@ fi
printf '%s\n' "$$" > "$lockfile" printf '%s\n' "$$" > "$lockfile"
printf "Started update at %(%c)T\n" -1 >> "$logfile" 2>&1 printf "Started update at %(%c)T\n" -1 >> "$logfile" 2>&1
logger -t rsync "Updating ${mirrormodule}" logger -t rsync "Updating ${mirrormodule}"
${rsync} "${opts[@]}" "${src}/" "${dst}/" >> "$logfile" 2>&1 rsync "${opts[@]}" "${src}/" "${dst}/" >> "$logfile" 2>&1
logger -t rsync "Finished updating ${mirrormodule}" logger -t rsync "Finished updating ${mirrormodule}"
printf "End: %(%c)T\n" -1 >> "$logfile" 2>&1 printf "End: %(%c)T\n" -1 >> "$logfile" 2>&1
rm -f $lockfile rm -f $lockfile