From 1c99b76c8c3c4387630cf563f05c7cfc55ed1fd9 Mon Sep 17 00:00:00 2001 From: Zane Williams Date: Tue, 23 Nov 2021 17:56:47 +0100 Subject: [PATCH] Add variable for rsync path, in case rsync not in $PATH. --- mirror/mirrorsync.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mirror/mirrorsync.sh b/mirror/mirrorsync.sh index 55f8a39..782b4bc 100644 --- a/mirror/mirrorsync.sh +++ b/mirror/mirrorsync.sh @@ -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"