| 
			
			 | 
		#1 | 
| 
			
			
			
			 Member 
			
			![]() Posts: 18 
				Karma: 12 
				Join Date: Aug 2013 
				
				
				
				Device: android kindle app, FB Reader, several tablets 
				
				
				 | 
	
	
	
		
		
			
			 
				
				Calibre Content Server Not Updating
			 
			
			
			So, I have this setup 
		
	
		
		
		
		
		
		
		
		
		
		
	
	1) Calibre running on my Ubuntu laptop, I add all of my books here, and will typically sync with a device here, if I am going to do this at all, usually, not so much that. 2) Calibre-server running on an Ubuntu server out on the interwebs integrated into apache via reverse proxy 3) I make changes to the library on the laptop, and then update the calibre server databse and file structure using a sync tool called Unison. 4) I reload the calibre server using an init script, reload apache for good measure, and then go to my web browser or even try FB Reader's remote library function to check for the changes and ... 5) Nothing Happens, the content served up is unchanging. Can anyone help me understand what I am missing here?  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#2 | |
| 
			
			
			
			 US Navy, Retired 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,897 
				Karma: 13806776 
				Join Date: Feb 2009 
				Location: North Carolina 
				
				
				Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 The metadata.db is the face of calibre if this file doesn't get changed then the content server will look as if nothing changed. If calibre on your laptop is still open when you run this it may prevent the sync tool from copying the metadata.db file and thus you don't see a change on your server. Or if the content server is running it has the metadata.db file open and may prevent the sync tool from altering it which again results in the metadata.db file from being changed. You might find this thread interesting. Even though the thread starts out talking about dropbox the result was a sync issue due to an open database. Good Luck. Last edited by DoctorOhh; 08-26-2013 at 10:52 PM.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#3 | |
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 1) You are not updating the database that the content server is really using. Check the various environment variables to be sure you haven't directed calibre to get the database somewhere else. 2) You are not actually restarting calibre, perhaps because of some fault in the init script. 3) You have a proxy server between your clients and calibre.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 Member 
			
			![]() Posts: 18 
				Karma: 12 
				Join Date: Aug 2013 
				
				
				
				Device: android kindle app, FB Reader, several tablets 
				
				
				 | 
	
	
	
		
		
			
			 
			
			Ok, I made certain to "killall calibre-server" on my server before initiating Unison sync, then PRESTO! It worked! That thread was interesting, thank youso much!  
		
	
		
		
		
		
		
		
		
		
		
		
	
	So, is there a preferred way to automate this sort of thing so that I do not have to manually ssh in, stop the server, sync, and restart the server? I have been looking, but haven't been able to recognize anything.  
		 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#5 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			You can do what I said I do in post #5 of that thread:  
		
	
		
		
		
		
		
		
		
		
		
		
	
	- use "monit" to monitor the timestamp of metadata.db. It restarts calibre if the timestamp changes - use monit to ensure that the server is actually running - have the calibre start/stop script copy the database to /tmp - set the environment variable CALIBRE_OVERRIDE_DATABASE_PATH to tell calibre where the db is located I don't use a start/stop script in /etc/init.d. I let monit take care of it. I run debian wheezy. The relevant monit sections are Code: 
	check process calibre-server with pidfile /var/run/calibre-server.pid
  start program = "/root/mon/calibre-server.sh start"
  stop program  = "/root/mon/calibre-server.sh stop"
  alert YOUR_EMAIL_ADDRESS_HERE only on { timeout, nonexist }
check file metadata.db with path /home/dropbox/Dropbox/Charles/Library/metadata.db
  if changed timestamp
     then exec "/root/mon/calibre-server.sh restart"
Spoiler: 
 The rest is up to you.
		 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#6 | 
| 
			
			
			
			 Member 
			
			![]() Posts: 18 
				Karma: 12 
				Join Date: Aug 2013 
				
				
				
				Device: android kindle app, FB Reader, several tablets 
				
				
				 | 
	
	
	
		
		
			
			 
				
				clarification...
			 
			
			
			Just to be sure I got this, 
		
	
		
		
		
		
		
		
		
		
		
		
	
	1) when Calibre opens the database to read on the server, even though it is not writing to the database file, it locks the file so that it cannot be written to, making syncing a pain 2) to get around this, you can either a) manually stop the calibre-server, sync, and restart it or b) use the method which you outlined above Using monit is nice and hands off. Ok, so that effectively makes it so that 1) when Calibre-server restarts, it copies the metadata.db to /temp, and reads it from there, leaving the "original" database unopened, and therefore unlocked and writable, syncable. 2) whenever the original database (on the server) is altered (synced up from the remote database on the laptop or home desktop installation of Calibre using dropbox, ubuntu one, rsync, Unison, or whatever), monit detects the timestamp alteration and restarts calibre, copying the new databse to temp, replacing the old there. I got this   Thank you for pointing that out, I did not recognize that in the post.
		 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#7 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			With the possible exception that sync programs may use delete/add instead of overwrite, your synopsis is correct. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Delete/add might be preferred by the sync folks because it avoid many of the locking problems. In this case calibre would be left holding an orphan file with no name, something it would never detect. I copy the dB away just in case. I am not sure it is always needed.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#8 | 
| 
			
			
			
			 creator of calibre 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609 
				Karma: 28549044 
				Join Date: Oct 2006 
				Location: Mumbai, India 
				
				
				Device: Various 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			@chaley: Actually, in newdb, when the last modified time of metadata.db changes, the content server closes and re-opens the connection to the db (as opposed to just refreshing). This should allow it to work with the delete and replace pardigm that sync programs use, though I haven't tested it myself.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#9 | |
| 
			
			
			
			 Comparer of the Ephemeris 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,496 
				Karma: 424697 
				Join Date: Mar 2009 
				
				
				
				Device: iPad 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 I added a book, changed metadata in another book, then waited for sync to complete. I opened a web view of calibre-server from a third location and the new books was listed and the metadata change was visible. It works! G  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#10 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Works for me as well: linux server running debian wheezy, calibre 1.0.0, synced from my windows desktop by dropbox, using the in-situ db (not a copy), monit turned off. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	On the other hand, with 1.0.0 browsing is much slower. Opening the "latest" page after a refresh takes 20 seconds for 2000 books. Using 0.9.44 it takes slightly more than a seconds. For the moment I will keep the older release and use monit.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
    
| Tags | 
| content server, databse, remote library, sync | 
| Thread Tools | Search this Thread | 
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Calibre Content Server and Windows Home Server 2011 | HughMcC | Calibre | 8 | 10-01-2014 08:26 AM | 
| Calibre server not updating over NAS | murkyl | Calibre | 6 | 02-10-2013 01:23 AM | 
| 500 Internal Server Error accessing content server Calibre 0.8.8 | DaddyO57 | Calibre | 1 | 07-20-2012 07:08 PM | 
| Calibre Server Not Updating | Fuller | Calibre | 1 | 11-21-2011 02:36 PM | 
| Calibre-server not updating | skells | Calibre | 16 | 07-22-2011 05:38 PM |