Add variable for rsync path, in case rsync not in $PATH.

This commit is contained in:
Zane Williams 2021-11-23 17:56:47 +01:00
parent 595cc86748
commit 1c99b76c8c
1 changed files with 4 additions and 3 deletions

View File

@ -31,7 +31,8 @@
# SOFTWARE.
#
# Find rsync in path or use "/usr/bin/rsync".
rsync=$(which rsync || /usr/bin/rsync)
# You can change v to q if you do not want detailed logging
opts=(-vrlptDSH --exclude="*.~tmp~" --delete-delay --delay-updates)
@ -56,7 +57,7 @@ logfile="$0.log"
# Check if the filelistfile has changed on upstream mirror
# and exit cleanly 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
printf "%s unchanged. Not updating at %(%c)T\n" "$filelistfile" -1 >> "$logfile" 2>&1
logger -t rsync "Not updating ${mirrormodule}: ${filelistfile} unchanged."
@ -79,7 +80,7 @@ fi
printf '%s\n' "$$" > "$lockfile"
printf "Started update at %(%c)T\n" -1 >> "$logfile" 2>&1
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}"
printf "End: %(%c)T\n" -1 >> "$logfile" 2>&1
rm -f "$lockfile"