Skip to content

Instantly share code, notes, and snippets.

@tyjak
Last active June 19, 2021 12:49
Show Gist options
  • Save tyjak/45209142f7aa3ac3710417c2de58cdf1 to your computer and use it in GitHub Desktop.
Save tyjak/45209142f7aa3ac3710417c2de58cdf1 to your computer and use it in GitHub Desktop.
#!/bin/zsh
# GistID: 45209142f7aa3ac3710417c2de58cdf1
# Sync one way opml file from ttrss server to newsbeuter
opml_file=${NEWS}.opml
news_file=$NEWS
ttrss_server=$TTRSS_SERVER
#sync_time=604800
sync_time=10
#newsboat_header='"query:Today:age=0"\
#"query:Unread Articles:unread = \\"yes\\""\
#"query:politique Articles:tags # \\"politique\\""\
#"query:ecologie Articles:tags # \\"ecologie\\""\
#"query:actu Articles:tags # \\"actu\\"\n'
current=`date +%s`
last_modified=`stat -c "%Y" $news_file`
if [ $(($current-$last_modified)) -gt $sync_time ]; then
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh"
fi
ssh $ttrss_server 'cd ttrss-docker && ./backup-opml.sh'
scp $ttrss_server:~/ttrss-docker/feeds.opml $opml_file
newsboat -u $news_file -i $opml_file
#sed -i "1s/^/${newsboat_header}\n/" $news_file
fi
newsboat -u $news_file
# backup-opml.sh
# docker-compose exec -T app sudo -Eu app php8 /var/www/html/tt-rss/update.php --opml-export admin:/var/www/html/feeds.opml
# docker cp ttrss-docker_app_1:/var/www/html/feeds.opml .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment