Saturday, November 15, 2014

Download Newspaper on Kindle by switching on RASPBERRY PI

In my earlier post I created a cron job on raspberry pi to download the newspaper via calibre on a pre defined time. (cron job is not enabled on RASPBMC by default. You need to enable it.).

But there could be times when you dont want to keep the raspberry pi switched on all the time just to wait till morning and let the cron job download the newspaper. The alternative is to schedule the job at startup. But again there is problem that there might be instances when i am working on some other thing on Raspberry and rebooting it mutliple time in a day. In that case my kindle will be flooded with the newspaper of same day.

Solution: I created a script to be scheduled at startup which will check the current time. If the current time is between 6:30 AM - 8 AM , the newspaper will download. Otherwise no.


Make the script executable. 

chomod +x /home/pi/scripts/time.sh

The above script can be schedule on Raspberry Pi (running RASPBMC) as follows - 

1. sudo nano /etc/rc.local
2. Add below line in the last of the file- just before exit.
    
   sh /home/pi/scripts/time.sh


Now if my RASPBERRY PI is not running over night then I just switch it on in the morning and get the newspaper delivered to my kindle.

Cheerz.

No comments:

Post a Comment