Commit: 3d65faf28bd404f81bec68a036cd6ae058475ba3 Parent: dca0214a17d50a57786a4b081eea71177710d66d Author: Randy Palamar Date: Thu, 11 Mar 2021 23:08:52 -0700 add cron script for updating RSS feeds with sfeed Diffstat:
| A | .config/cron/crontab | | | 2 | ++ |
| A | .config/cron/rssup.sh | | | 38 | ++++++++++++++++++++++++++++++++++++++ |
| M | .config/x11/xinitrc | | | 2 | +- |
3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/.config/cron/crontab b/.config/cron/crontab @@ -0,0 +1,2 @@ +# Update RSS +0 */6 * * * ~/.config/cron/rssup.sh blogs soft yt 2>&1 >/dev/null diff --git a/.config/cron/rssup.sh b/.config/cron/rssup.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +# updates rss feeds with sfeed +# sends a notification when a new entry is found + +[ ${#} -lt 1 ] && ( + echo 'Wrong number of arguments' + exit 1 +) + +configdir=~/.config/sfeed + +tmp=$(mktemp) +trap '[ -f "$tmp" ] && rm $tmp' EXIT HUP INT + +update() { + sfeed_update $configdir/${1}.rss + wait + html ${1} +} + +html() { + sfeed_html $sfeedpath/* >| $tmp + compare ${1} +} + +compare() { + cmp -s $tmp $configdir/html/${1}.html || ( + mv $tmp $configdir/html/${1}.html && + notify-send "New RSS Entries: ${1}" + ) +} + +for arg; do + . $configdir/${arg}.rss + [ -d "$sfeedpath" ] || mkdir -p "$sfeedpath" + update $arg +done diff --git a/.config/x11/xinitrc b/.config/x11/xinitrc @@ -5,7 +5,7 @@ gpg_flags="--daemon --default-cache-ttl 7200 --max-cache-ttl 36000 --no-allow-e [ $(pgrep gpg-agent) ] || gpg-agent $gpg_flags [ $(pgrep mpd) ] || mpd -[ $(pgrep cron) ] || cron -f ~/.config/crontab +[ $(pgrep cron) ] || cron -f ~/.config/cron/crontab [ $(pgrep xbanish) ] || xbanish & [ $(pgrep status) ] || status &