This is a script that must send an email at each new article published on a specific website. Any suggestions or improvements to do?
SENDER_EMAIL="[email protected]"
TO_EMAIL="[email protected]"
RSS_SITE="example.com/feed.xml"
CHECK_INTERVAL=10
while [ 1 ]; do
LINK_ARTICLE=$(rsstail -i 1 -u $RSS_SITE -l -n 0 -1 | grep -oP "Link:+ \K.*")
TITLE_ARTICLE=$(rsstail -i 1 -u $RSS_SITE -n 0 -1 | grep -oP "Title:+ \K.*")
if [ "$LINK_ARTICLE" != "" ] && [ "$TITLE_ARTICLE" != "" ]; then
echo "New article published on the site. TITLE: $TITLE_ARTICLE - LINK: $LINK_ARTICLE" | EMAIL="$SENDER_EMAIL" mutt -s "Nuovo Articolo BDO" "$TO_EMAIL"
echo "New article published on the site. TITLE: $TITLE_ARTICLE - LINK: $LINK_ARTICLE"
fi
sleep $CHECK_INTERVAL
done