My friend x23b5 has an Amazon Kindle and wants to read daily newspapers each morning.
Time for a cron job on my Pogoplug to send some newspapers to this Kindle 🙂
There is a pretty cool package called calibre.
It can convert online newspapers to ebook specific files and send it via email to your eBook Reader.
Install calibre
pacman -Sy calibre
Calibre uses recipes to fetch news and convert those to ebook files like .mobi or .epub.
You can list all available recipes with the following command:
ebook-convert --list-recipes
Note: It’s a good idea to create a new email for this task because your password will be saved in plain text. Use a freemailer or create a new user on your own mailserver.
Create the following file in /usr/local/bin/calibre-cron and replace all variables and recipes with yours.
I used another usb stick (cacheStick) to save the temp files because I want to protect my arch linux stick.
To change the output format just change the file extension.
nano /usr/local/bin/calibre-cron
#!/bin/bash TEMPPATH=/media/cacheStick/calibre/ SERVER_ADDRESS=smtp.mailserver.com USERNAME=myusername PASSWORD=mypassword FROM_EMAIL=ebook@mailserver.com TO_EMAIL=testuser@kindle.com # Netzpolitik ebook-convert "Netzpolitik.recipe" ${TEMPPATH}netzpolitik.mobi calibre-smtp -a ${TEMPPATH}netzpolitik.mobi -s "Netzpolitik" -r $SERVER_ADDRESS -u $USERNAME -p $PASSWORD $FROM_EMAIL $TO_EMAIL "Netzpolitik" # Heise ebook-convert "Heise-online.recipe" ${TEMPPATH}heise.mobi calibre-smtp -a ${TEMPPATH}heise.mobi -s "Heise" -r $SERVER_ADDRESS -u $USERNAME -p $PASSWORD $FROM_EMAIL $TO_EMAIL "Heise" # Berliner Zeitung ebook-convert "Berliner Zeitung.recipe" ${TEMPPATH}bz.mobi calibre-smtp -a ${TEMPPATH}bz.mobi -s "Berliner Zeitung" -r $SERVER_ADDRESS -u $USERNAME -p $PASSWORD $FROM_EMAIL $TO_EMAIL "Berliner Zeitung"
Make it executable:
chmod u+x /usr/local/bin/calibre-cron
Execute it and check whether it works.
Now we have to create a cron job to execute this script each morning.
Execute this command before you edit your crontab file.
export EDITOR="/usr/bin/nano"
Edit your crontab file:
crontab -e
# daily at 5:00 0 5 * * * /usr/local/bin/calibre-cron > /dev/null 2>&1
“> /dev/null 2>&1” because I don’t need any email or log output.
Now enable cron service:
systemctl enable cronie systemctl start cronie
Calibre is pretty memory and cpu intensive and takes pretty long! You should run it overnight otherwise your plug pc will be very slow.
How it looks like:
Thanks for the tutorial.
The cron part was driving me nuts, because ArchLinux doesn’t use cron by default, but pacman -Sy cronie and everything works great now.
Cheers
Why do you people post this on two seperate blogs? Y U NO merge teh blocks?
’cause we’ve mostly got different toppics.