about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-07-17 23:38:21 -0500
committerCase Duckworth2022-07-17 23:38:21 -0500
commitd5b7cd9dbd18b1cfc284b707e6083d7e6bd80008 (patch)
treeae0c6d3a6e876b154cc6693e37d56d80276af63c
parentAdd r/emacs (diff)
downloadsfeed-d5b7cd9dbd18b1cfc284b707e6083d7e6bd80008.tar.gz
sfeed-d5b7cd9dbd18b1cfc284b707e6083d7e6bd80008.zip
Archive feeds older than 60 days
-rwxr-xr-xrunsfeed6
1 files changed, 4 insertions, 2 deletions
diff --git a/runsfeed b/runsfeed index f987a92..e6714a7 100755 --- a/runsfeed +++ b/runsfeed
@@ -27,6 +27,8 @@ main() {
27 atom "$sfeedpath" 7 >"$SFEED_OUTPUT/feeds-short.xml" 27 atom "$sfeedpath" 7 >"$SFEED_OUTPUT/feeds-short.xml"
28 log Generating OPML... 28 log Generating OPML...
29 opml "$sfeedrc" >"$SFEED_OUTPUT/feeds.opml" 29 opml "$sfeedrc" >"$SFEED_OUTPUT/feeds.opml"
30 log Archiving old feeds...
31 archive "$sfeedpath"/*
30 log Done. 32 log Done.
31} 33}
32 34
@@ -63,9 +65,9 @@ atom() ( # atom DIRECTORY [DAYS]
63 sfeed_atom 65 sfeed_atom
64) 66)
65 67
66sfeed_archive() ( # sfeed_archive FEED ... 68archive() ( # sfeed_archive FEED ...
67 for feed; do 69 for feed; do
68 awk -v old="$(($(date +%s) - (15 * 24 * 3600)))" \ 70 awk -v old="$(($(date +%s) - (60 * 24 * 3600)))" \
69 -F '\t' 'int($1) > old' <"$feed" >"$feed.new" 71 -F '\t' 'int($1) > old' <"$feed" >"$feed.new"
70 mv "$feed" "$feed.old" 72 mv "$feed" "$feed.old"
71 mv "$feed.new" "$feed" 73 mv "$feed.new" "$feed"