View Single Post
Old 12-27-2016, 09:00 AM   #3
Ersatzreifen
Bibliothekar
Ersatzreifen began at the beginning.
 
Ersatzreifen's Avatar
 
Posts: 38
Karma: 10
Join Date: Jun 2011
Location: San Jose City, Philippines
Device: Galaxy Tab S w/Bookari Premium
Quote:
Originally Posted by kovidgoyal View Post
Perhaps it slipped by you that the calibre server is read-only. So it cannot do things like adding new books to the calibre library which is needed for news download. You dont want to run the main calibre program then setup cron jobs to download the news for you. That's what cron is for.
Perhaps it slipped by YOU that I haven't done any programming since before 1980. In those days we could rewrite programs to do things like that. There's no reason as far as I can see where calibre has to be read only, that's just a programmer's personal aesthetics. It could work both ways, as does an ftp server. That way people could even do amazing things like upload ebooks which get put into a quarantine directory to be vetted before merging into the library. But then, what do I know? Perhaps compilers have evolved to the point where it's no longer possible to write server software that can upload, download, and fetch files. Or maybe it's paranoia. Or just personal aesthetics.

I thought of using crontab, and I figured that if there were a separate program dedicated to doing just that, crontab would be perfect. But when I looked into /opt/calibre/bin/ I didn't see any separate module to handle only downloading news from a cron job, (which would have been a perfect solution.) Or maybe calibre-download-news (or whatever you call it) "slipped by me". So, if I can just start caliber from a cron job just to grab news downloads only, how do I instruct it to do only that, then terminate to free up memory as soon as it's done?

I checked "calibre --help" and there's no procedure for this; nothing to tell it to ONLY download news, then exit as soon as it's done. There is a "-s, --shutdown-running-calibre" switch, but then I have to guess how long downloads will take and run a second cron job just to terminate the first. Possible, but messy programming!

So tell me, how would you write the cron job so that it only grabs the news then terminates cleanly?
Ersatzreifen is offline   Reply With Quote