From af52f540a750ec8ef4700711ea87c50f9b385fb1 Mon Sep 17 00:00:00 2001 From: Zach van Rijn Date: Wed, 6 Oct 2021 09:16:01 -0500 Subject: scripts/healthchecks: make failure records persistent --- scripts/healthchecks | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'scripts/healthchecks') diff --git a/scripts/healthchecks b/scripts/healthchecks index f50a9a3dd..9742ec3fd 100755 --- a/scripts/healthchecks +++ b/scripts/healthchecks @@ -23,8 +23,8 @@ # Configurable paths. # HERE="$(dirname $(readlink -f ${0}))"; -TEMP="$(mktemp -d)"; # temp dir for further analysis -SAVE="${HERE}/../cache"; # successful download cache dir +TEMP="$(mktemp -d)"; # tmp dir for intermediate files +SAVE="/var/www/source/archive"; # successful download cache dir ## @@ -62,13 +62,16 @@ try_down () ## - # Record any possible failure. + # Record any possible failure if new, otherwise delete it. # if test ${okay} -ne 0; then - printf >> "${TEMP}/fail.list" "%s %s %s\n" \ + grep 1>/dev/null "${name}" "${SAVE}/_savefail.txt" && return; + printf >> "${SAVE}/_savefail.txt" "%s\t%s %s\n" \ "${okay}" "${name}" "${down}" \ ; return; + else + sed -i "${SAVE}/_savefail.txt" -e "/\b${name}\b/d"; fi @@ -122,7 +125,7 @@ gen_sums () # main loop mkdir -p "${SAVE}"; -touch "${TEMP}/fail.list"; +touch "${SAVE}/_savefail.txt"; touch "${SAVE}/SHA512SUMS"; printf "We will now begin processing matching packages:\n"; @@ -209,10 +212,10 @@ done # analysis printf "\nThe following source files failed to download:\n\n"; -cat "${TEMP}/fail.list"; +cat "${SAVE}/_savefail.txt"; printf "\nThe following source files exist but mismatch:\n\n"; -uniq -u "${SAVE}/SHA512SUMS"; +uniq -u "${SAVE}/SHA512SUMS" | tee "${SAVE}/_hashfail.txt"; #--------------------------------------------------------------- -- cgit v1.2.3-60-g2f50