From e505d27bf36a7377c40ce1199490350ad57a522e Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Tue, 21 Apr 2015 17:32:07 +0200 Subject: check-hosts: Cleanup removed hosts Remove orphaned stale hosts state files for removed hosts. --- check-hosts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check-hosts b/check-hosts index e629bab..6c7dcfd 100755 --- a/check-hosts +++ b/check-hosts @@ -40,8 +40,8 @@ get_stale_once() { ) done - comm -13 <(get_stale | sort) <(get_all | sort) | while read host; do - STALE_FILE="${STALE_DIR}/${host}" + comm -23 <(ls -1 ${STALE_DIR}/ | sort) <(get_all | sort) | while read file; do + STALE_FILE="${STALE_DIR}/${file}" test -f "${STALE_FILE}" && rm -f "${STALE_FILE}" done } -- cgit v1.2.3-1-g7c22