Exit cleanly if file list is unchanged at mirrorsync run init.

This commit is contained in:
Zane Williams 2021-11-23 17:53:49 +01:00
parent 24eb7740e2
commit 595cc86748
1 changed files with 2 additions and 2 deletions

View File

@ -55,12 +55,12 @@ lockfile="$0.lockfile"
logfile="$0.log" 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 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 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."
exit 1 exit 0
fi fi
# Check for existing lockfile to avoid multiple simultaneously running syncs # Check for existing lockfile to avoid multiple simultaneously running syncs