02-11-2014, 09:30 PM | #1 |
Junior Member
Posts: 8
Karma: 10
Join Date: Feb 2011
Device: htc desire
|
Shutting down remote calibre instance
Having a quick scan through the current ideas I can not see anything obvious so here is my idea for a plugin...
My senario is this I have calibre server running a library on a FreeNAS server (within its own jail.) I have the management application installed on my laptop. Normally the NAS server is running 24/7 and is accessable pretty much anywhere. When I need to add books or manage the library, I fire up the management software and do my thing. The problem is that I need to shutdown the calibre server on the NAS server first before I can make changes to the databases. It would be nice if the server could advertise itself and respond to start and stop commands automatically when the management software is up and running. I am not sure if this functionality already exists in Calibre and can be accessed via plugin development or would need changes to the server code directly. I am a programmer and I would love to take this on however my current commitments are pretty heavy. Feedback is welcome. Cheers Bick |
02-11-2014, 09:57 PM | #2 | |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
|
|
Advert | |
|
02-12-2014, 08:10 AM | #3 |
Junior Member
Posts: 8
Karma: 10
Join Date: Feb 2011
Device: htc desire
|
Thanks, but I think you need to read my post again.
Just to be clear: I am already running calibre server as a separate process on a freeNAS server (linux). I am running the management processes on a separate PC, in this case a laptop running windows. What I am looking for is a way to force calibre to use the calibre server process of my choosing. with some kind of command line switch. thanks Bick Last edited by bickleigh; 02-12-2014 at 09:04 AM. |
02-12-2014, 08:52 AM | #4 |
Junior Member
Posts: 8
Karma: 10
Join Date: Feb 2011
Device: htc desire
|
A possible to solution to this is to shutdown the conflicting server that is running in the windows processes. Is it possible to shutdown the calibre-server process running on a windows installation?
|
02-12-2014, 03:23 PM | #5 | |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
But you should be able to find calibre-server(.exe) running in Task Manager/top, and/or kill any running processes via a script. I believe calibre-server won't see changes made when running as it's own process, but it won't lock the database or cause conflicts, as calibre-server is a read-only process. |
|
Advert | |
|
02-12-2014, 03:50 PM | #6 |
Junior Member
Posts: 8
Karma: 10
Join Date: Feb 2011
Device: htc desire
|
Ok thanks for that.
I was hoping for a cleaner solution but I'll go with what you have suggested. I can knock up a batch file to shutdown the calibre-server process when I fire up calibre on my laptop. Thanks again Bick |
02-12-2014, 04:36 PM | #7 |
Junior Member
Posts: 8
Karma: 10
Join Date: Feb 2011
Device: htc desire
|
Unfortunately that turned out to be a dead end.
When you run Calibre on Windows there is no seperate task running for the calibre server. It appears to be integrated into the main Calibre program. So apart from hacking on the source and recompiling to create a modified version of Calibre, is it possible to shut down the calibre-server on a Windows installation via a plugin? In other words, When I fire up Calibre on Windows could I integrate an option (via plugin) where I could shut down the server process. This would create the reverse of the Calibre-server headless setup, i.e we have the GUI without the server as a opposed to the server without the GUI. I know there are various solutions to this problem, like running identical db's and syncing but I think that is messy and wastes disk space, I am looking for a more elegent solution. Maybe Mr Goyal could offer an opinion on the matter? Thanks Bick |
02-12-2014, 04:43 PM | #8 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
You can find it in the installed folder, as calibre-server.exe. It doesn't have a presence in the start menu, but it absolutely can be run via the command line. I am looking at the executable right now.
|
02-12-2014, 04:52 PM | #9 | |
Well trained by Cats
Posts: 30,490
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
There is a separate CLI calibre-server.exe that others are talking about |
|
02-12-2014, 05:02 PM | #10 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Maybe look at this?
http://manual.calibre-ebook.com/server.html#in-process You can run calibre-server inside apache with WSGI, and it should run inside the apache service and start up on request, so it will always query the updated database. |
02-12-2014, 09:34 PM | #11 |
Junior Member
Posts: 8
Karma: 10
Join Date: Feb 2011
Device: htc desire
|
Ok guys thanks for your help...
Unfortunately I am not making myself understood here. I am aware of the caliber-server CLI on both the linux version and windows version. My library is on the linux NAS server; I am running the calibre-server process on the linux box to service the library. The db is also on the Linux box. The db is is locked by the calibre server process as is expected. To manage the library on the linux box I use the windows version of the Calibre gui and this is running on a laptop. I point the gui at the db and library on the linux box. However because the db is locked by the calibre-server on the linux box, any changes or additions are rejected because I don't have permission,the db is locked by the calibre-server process running on the linux box. I don't want the calibre-server.exe running on my laptop so lets park that. My question is this: Can the calibre-server process running on the linux box be started or stopped remotely via a calibre gui running on my windows laptop? For example: I also run a program called serviio on the linux box which is a highly recommended DLNA server. The server manages film, pictures, music, anything non ebook related in fact. I manage the DLNA server and content on the linux box via a gui that runs on my laptop(windows). The gui connects to the DLNA Server running on the linux box using a built in REST interface and I can start, stop the server, make changes and do what ever I need to do, all done remotely via my windows laptop. It would be nice to be able to manage the calibre library and db on the linux NAS remotely via the Calibre gui with out having to manually access the linux NAS via it's own web frontend gui, shutdown the calibre-server process, go back to my laptop make changes, go back to the nas gui, start the server again. See what I am getting at. It would be nice to do it all from with in the calibre GUI running on my laptop. I could see an option that tells me the the status of the calibre-server, that it is running and as changes are made or books are added the Calibre gui would shutdown the content server running on the linux box, make its changes then fire up the content server again. This would trigger a message to any user that is accessing the library at the time. Apologies for labouring the point here but this has been a source of frustration to me for a while. Many thanks for your patience. Bick Last edited by bickleigh; 02-12-2014 at 09:44 PM. |
02-12-2014, 09:53 PM | #12 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
A couple of things:
I did understand that. I am confused at your suggestion that /opt/calibre/calibre-server (or wherever) is locking the database, as that is against what I have come to expect -- the server is read-only access to the database, so as far as I know, it doesn't lock the db. It has been used successfully at the same time as /opt/calibre/calibre You want a plugin that will ssh into another computer and kill the calibre-server process? Aint happening. You can however, make a script to do that, and use it in the startup script. However, it's worth noticing that running both at the same time will not break anything, it will merely leave the server out of date until it restarts. I would try the WSGI plugin to apache (or whatever server) since it should re-initialize calibre-server on each access, as needed, and stay up-to-date. Or script a bat script to do the windows equivalent of "ssh my-NAS; killall calibre-server; calibre-server; exit" which will restart calibre-server on demand. If your db is being locked up by /opt/calibre/calibre-server, then I think something is wrong. Last edited by eschwartz; 02-13-2014 at 12:40 AM. |
02-12-2014, 10:38 PM | #13 | |
Well trained by Cats
Posts: 30,490
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Been there I still am finding folders with 2 case versions of the same book. The Library maintenance tool does not even see these under W7, but I can see (and delete) them in explorer. It is a PITA to have to first match title case in the spreadsheet, then go delete the mismatch. |
|
02-12-2014, 11:15 PM | #14 | |
Grand Sorcerer
Posts: 12,856
Karma: 75642378
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
|
Quote:
Take a look at these threads: https://www.mobileread.com/forums/sho...d.php?t=220950 https://www.mobileread.com/forums/sho...d.php?t=212354 https://www.mobileread.com/forums/sho...d.php?t=221476 in particular https://www.mobileread.com/forums/sho...04&postcount=5 and https://www.mobileread.com/forums/sho...35&postcount=5 and |
|
02-13-2014, 09:50 PM | #15 |
Junior Member
Posts: 8
Karma: 10
Join Date: Feb 2011
Device: htc desire
|
Thanks for the feedback guys.
@eschwartz - While I agree the calibre-server is a read-only process, python still locks the db when it is opened for reading and that is the observed behaviour. Which is the reason why I have to shut down the content server on the linux box every time I need to make changes. @theducks. Thanks for your advise. I can see how there might be problems as you mentioned, but in my case I let calibre do the work. I have set up a directory that calibre monitors and I am careful to add books that have a specific name convention. The eBook is dropped into the directory and Calibre does the rest. The eBook is automatically pulled into calibre, file name parsed, renamed and stored in the library. In the 9 months I have been using this particular set-up I have never had any problems. In fact the whole system (apart from the Content-server shut-down problem) works like a dream. When I get a new book I rename it drop it to the monitored directory, wait a few seconds, it then disappears and next it is in the library complete with metadata (some times I will need to edit the metadata manually)... it's great! so easy. @PeterT - Thanks for the links - Some good information there and some good ideas. However for my purposes they are a little too convoluted. It has given me some ideas though. I think now that I understand that the content-server does not respond to any commands I think I will knock up a simple plugin that uses ssh (possibly PuTTY CLI or openSSH) to remotely run a script on the Linux box to shut-down the content server when I fire up calibre on my laptop and then let the plugin fire off another script to start the server when I shut-down calibre. So once again thanks for your help, patience, and most importantly your valuable feedback. Cheers Bick |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre shutting itself down? | Turtle91 | Devices | 2 | 10-17-2013 11:40 PM |
Use calibre to manage remote calibre library | aarcane | Related Tools | 8 | 04-06-2013 02:40 AM |
Remote Calibre Backup? | jamng | Related Tools | 3 | 12-09-2011 09:50 AM |
Using Calibre as a client for another Calibre instance? | toddos | Calibre | 27 | 06-30-2010 05:57 AM |
Calibre kills remote NX session... | Egnaled Knarf | Calibre | 2 | 01-28-2010 06:51 PM |