Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 01-03-2011, 09:22 AM   #1
skells
Junior Member
skells began at the beginning.
 
skells's Avatar
 
Posts: 7
Karma: 10
Join Date: Jan 2011
Device: Nook
Calibre-server not updating

I am keeping my library in sync using Dropbox, but I prefer to use my server to host the calibre web site rather than drobpox itself. I am using calibre-server on Fedora 14 and it works great except that the site is not updating when I add new content. If I kill the process and relaunch, then it's up to date, but it's far from ideal. I am using the --with-library /path --daemonize --auto-reload switches in that order. Is there a better way?

Also, I'm not so great at init scripts, does anyone know of how to launch calibre-server as an init daemon on fedora/red hat?

Thanks
skells is offline   Reply With Quote
Old 01-03-2011, 02:35 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,458
Karma: 5383257
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The calibre server uses the last modified timestamp of the metadata.db file to check if it needs to refresh itself. Presumably, that timestamp is not being changed in tour setup for some reason.
kovidgoyal is offline   Reply With Quote
 
Advertisement
Old 01-03-2011, 02:58 PM   #3
itimpi
Wizard
itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.
 
Posts: 4,112
Karma: 780247
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
If any process is keeping the metadata.db file open, then that will stop the Dropbox synchronization from taking place (including updating file timestamp). Sounds to me as if that could be the problem.
itimpi is offline   Reply With Quote
Old 01-03-2011, 05:25 PM   #4
skells
Junior Member
skells began at the beginning.
 
skells's Avatar
 
Posts: 7
Karma: 10
Join Date: Jan 2011
Device: Nook
I only keep the full program open when necessary and when I close it I see that the metadata.db gets synced on dropbox afterward. Calibre-server is read-only on the database, right? I'm not sure what else could be keeping it open but I'll check the machines I replicate with.
skells is offline   Reply With Quote
Old 01-03-2011, 05:27 PM   #5
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,923
Karma: 1673776
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by skells View Post
Calibre-server is read-only on the database, right?
No. It is read/write, because that is the interface SQLite presents to python. It doesn't write, but it can.
chaley is offline   Reply With Quote
Old 01-03-2011, 09:35 PM   #6
skells
Junior Member
skells began at the beginning.
 
skells's Avatar
 
Posts: 7
Karma: 10
Join Date: Jan 2011
Device: Nook
That seems kind of counter-productive. If nothing else is keeping a lock on the database and I can verify that time stamps are synced to the machine running calibre-server, how can I set it to automatically refresh itself? Am I using the wrong arguments?
skells is offline   Reply With Quote
Old 01-04-2011, 05:58 AM   #7
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,923
Karma: 1673776
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by skells View Post
That seems kind of counter-productive. If nothing else is keeping a lock on the database and I can verify that time stamps are synced to the machine running calibre-server, how can I set it to automatically refresh itself? Am I using the wrong arguments?
We don't have a choice. The python sqlite interface opens the DB read/write.

As for the rest of your question: are you saying that dropbox is changing the timestamp of the file and calibre-server is not seeing that change?

If dropbox is not updating the database while calibre-server is running, then I see only two workarounds:
1) periodically stop and restart calibre-server
2) use one of the other techniques to serve your content. For example, it might be easier to start/stop the server using the WSGI interface. You could use calibre2opds to periodically generate a new website. You could also use the calibre php server. All of these options bring along some inconveniences, so I would suggest option 1 as the best way forward.
chaley is offline   Reply With Quote
Old 01-04-2011, 07:39 AM   #8
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 8,909
Karma: 12755553
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Quote:
Originally Posted by chaley View Post
As for the rest of your question: are you saying that dropbox is changing the timestamp of the file and calibre-server is not seeing that change?

If dropbox is not updating the database while calibre-server is running, then I see only two workarounds:
Dropbox no longer locks the metadata.db file when calibre is open. Any changes to metadata.db are quickly passed through to dropbox and the timestamp is changed. It has been this way since late in the last beta phase. The OP should ensure he is using the latest dropbox, version 1.0.10. New versions automatically update, but older versions didn't.

I have not verified that dropbox works this way for the content server. I would be surprised if it operated differently, but then again...
DoctorOhh is offline   Reply With Quote
Old 01-04-2011, 08:29 AM   #9
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,923
Karma: 1673776
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by dwanthny View Post
Dropbox no longer locks the metadata.db file when calibre is open. Any changes to metadata.db are quickly passed through to dropbox and the timestamp is changed.
Thanks for the info!

You seem to be describing sending data to the cloud for open files. What about the other way? Will dropbox modify the db using data from the cloud when calibre has the db open?
chaley is offline   Reply With Quote
Old 01-04-2011, 08:47 AM   #10
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 8,909
Karma: 12755553
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Quote:
Originally Posted by chaley View Post
You seem to be describing sending data to the cloud for open files. What about the other way? Will dropbox modify the db using data from the cloud when calibre has the db open?
No. If I have dropbox open on my machine and someone on another machine decides to add a book(which is a no-no) my computer will never see that book. I might get a file called metadata(Home-machine's conflicted copy 2010-12-27).db file on my machine. This tells me the machine that created the file and the date it was created/updated.

Since I am the only person who updates things it isn't a problem. But last week I did leave calibre open on my home machine and updated many files on my work machine. I restarted calibre but certain books were missing or covers were missing. Because the database file structure entries were updated but the metadata.db file wasn't.

Upon realizing what I had done I closed calibre then went into the calibre library and copied the conflicted metadata.db file to metadata.db, restarted calibre and all of my changes were there. I could also have gone to the web and restored the last updated version that was timestamped while I was at work.

Using dropbox you do have to pay attention when you have apparent errors or the fix might take a lot longer then it should. In the above case it took just a couple of minutes. If I didn't realize the nature of the problem I could easily have cursed out calibre (when in fact it would have been human error) and entered everything again.

So far restoring books from my dropbox as protected me from myself more then once.

Last edited by DoctorOhh; 01-04-2011 at 09:01 AM.
DoctorOhh is offline   Reply With Quote
Old 01-04-2011, 10:23 PM   #11
skells
Junior Member
skells began at the beginning.
 
skells's Avatar
 
Posts: 7
Karma: 10
Join Date: Jan 2011
Device: Nook
Yep, I'm running the latest and greatest of Calibre and dropbox. Dropbox definitely passes the timestamp change. Ah well, at this point I just have a cron job stop and restart calibre-server.
skells is offline   Reply With Quote
Old 01-23-2011, 11:34 PM   #12
Dovahn
Junior Member
Dovahn began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Jan 2011
Device: Kindle DX
I'm having the same problem. I'm using calibre-server --with-library /path --daemonize --auto-reload and syncing the server library using SSH ftp (not dropbox, so the dropbox issues don't apply to me). I can confirm that the last modified timestamp is being updated on the server, but the running calibre-server process doesn't seem to be updating.

Are other similar setups working properly? Does the server check for updates on a fixed schedule? I can't seem to get the server to update while its running. Thanks for your help.
Dovahn is offline   Reply With Quote
Old 03-31-2011, 07:17 PM   #13
Tedderouni
Junior Member
Tedderouni began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Mar 2011
Device: Kindle 3
Has anyone gotten this working? I'm having the same problem. I'm not using Dropbox in my setup, I just have Calibre-server 0.7.52 running on a Fedora 14 server. I can't get the server to update its content without restarting it after adding new ebooks to the library. The metadata.db timestamp is being updated, and lsof confirms that the only process holding it open is calibre-server. My startup command is calibre-server --with-library /path -p 80 --daemonize --auto-reload. Is there a way to make it update automatically without a restart when new content is added to the library? Or at least is there a way to manually make it re-read metadata.db so I can avoid a total restart?
Tedderouni is offline   Reply With Quote
Old 04-04-2011, 10:11 AM   #14
skells
Junior Member
skells began at the beginning.
 
skells's Avatar
 
Posts: 7
Karma: 10
Join Date: Jan 2011
Device: Nook
I ended up running calibre-server with an init script then I schedule a periodic restart of the service. Not optimal, but it works. I'm just not sure what the --auto-reload is for, it doesn't seem to do anything.
skells is offline   Reply With Quote
Old 04-06-2011, 08:02 PM   #15
Tedderouni
Junior Member
Tedderouni began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Mar 2011
Device: Kindle 3
I seem to have solved the problem on my end. I'm running this on a virtual machine, and I noticed the system time was off by a couple minutes. So I enabled ntpd, and once it had corrected the time, calibre-server magically started updating automatically. I'm guessing this is because I have my calibre library shared via NFS to multiple computers, and since their time wasn't synced to the VM's time, it broke calibre's timestamp checking of metadata.db. To start ntpd, type 'service ntpd start' and to enable it at boot, type 'chkconfig ntpd on'. If it's not installed, type 'yum install ntp' to install it.

Also, if you're still looking for an init script, I've come up with one. As root, paste the script below into a file named calibre in /etc/init.d/ and be sure to at least change the path to your library and anything else you need to do differently in the INI line (line 14). Then type 'chkconfig --add calibre' to enable it and 'service calibre start' to start it. The script is fairly generic, but I did add a workaround for calibre's command line segfaults, and also added a check to see if it's already running, since the built-in checking didn't seem to work for this for some reason.

Note that this script sets the port to 80, the default HTTP port. Specifically, this is done by the "-p 80" in the INI line. With this setting, you can go to the web interface using only the address, without having to specify a port, i.e. http://your.calibre.address/. However, if you already have another web server running on port 80 on the same interface, calibre will have to use a different port. Calibre server defaults to port 8080, so if you remove the "-p 80" you'll have to use http://your.calibre.address:8080/. Or if you want to use a different port, specify it with "-p <port>" and then use http://your.calibre.address:<port>/.

Code:
#!/bin/sh
#
#
# chkconfig: 345 99 15
# description:   Start/Stop the Calibre Server.
# processname: calibre-server
# pidfile: /var/run/calibre.pid

# Source function library.
. /etc/init.d/functions

#Edit the variables to suit your file locations
EXE="/usr/bin/calibre-server"
INI="--with-library /path/to/calibre_library/ -p 80 --daemonize --auto-reload --pidfile /var/run/calibre.pid"
PID="/var/run/calibre.pid"

RETVAL=0

# See how we were called.

start() {
        echo -n "Starting Calibre Server: "

	# See if it's already running
	RUNNING=0
	ps -ef |grep -v grep |grep -q calibre-server
	[ $? -eq 0 ] && RUNNING=1

	# The ps in the daemon command makes the status OK despite Calibre's expected segfault:
        [ $RUNNING -eq 0 ] && \
		daemon "${EXE} ${INI} 2> /dev/null ; ps -ef |grep -v grep |grep -q \"calibre-server ${INI}\"" || \
		echo "Calibre server already running."

        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch ${PID}
        return $RETVAL
}

stop() {
        echo -n "Stopping Calibre Server: "
        killproc ${EXE}
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f ${PID}
        return $RETVAL
}

rhstatus() {
        status ${EXE}
}

restart() {
        stop
        start
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  status)
        rhstatus
        ;;
  *)
        echo "Usage: ${EXE} {start|stop|status|restart}"
        exit 1
esac

exit $?

Last edited by Tedderouni; 07-22-2011 at 06:01 PM. Reason: Explaining port setting
Tedderouni is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
UPDATING Calibre ginette Calibre 8 11-16-2014 12:21 AM
updating calibre wrenn1 Kobo Reader 2 06-29-2010 01:22 AM
Problem since updating to Calibre 6.45 garybob Calibre 8 03-19-2010 02:23 PM
Updating Calibre drcjsnider Calibre 3 01-08-2010 01:17 PM
Calibre won't open since updating bobsi18 Calibre 14 11-14-2009 06:03 PM


All times are GMT -4. The time now is 10:31 PM.


MobileRead.com is a privately owned, operated and funded community.