Commit: 05427f6f6f46378c143fbd263eb0c20037fe1752 Parent: 09dbe9495e5fc87f760db3385e7b88b0931d3955 Author: Randy Palamar Date: Sun, 30 Jul 2023 17:43:06 -0600 add sfeed_clean script and run it weekly Diffstat:
M | .config/cron/crontab | | | 1 | + |
A | bin/sfeed_clean | | | 16 | ++++++++++++++++ |
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/.config/cron/crontab b/.config/cron/crontab @@ -1,2 +1,3 @@ # Update RSS 0 */2 * * * ~/bin/rssup blogs soft videos 2>&1 >/dev/null; pkill -RTMIN+3 status +0 7 * * 1 ~/bin/sfeed_clean diff --git a/bin/sfeed_clean b/bin/sfeed_clean @@ -0,0 +1,16 @@ +#!/bin/sh + +# cleans up stale urls in ${SFEED_URL_FILE} + +files=$(find "${XDG_CACHE_HOME}/sfeed" -type f | grep -v "${SFEED_URL_FILE}") +tmp=$(mktemp) +awk -F '\t' ' +{ url[$3] = 1 } +END { + while ((getline < "'"${SFEED_URL_FILE}"'") > 0) { + if (url[$0]) + print $0 + } +}' ${files} > "${tmp}" + +mv "${tmp}" "${SFEED_URL_FILE}"