View Single Post
Old 04-06-2011, 07:02 PM   #15
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>/.

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

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

#Edit the variables to suit your file locations
INI="--with-library /path/to/calibre_library/ -p 80 --daemonize --auto-reload --pidfile /var/run/"


# See how we were called.

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

	# See if it's already running
	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 -eq 0 ] && touch ${PID}
        return $RETVAL

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

rhstatus() {
        status ${EXE}

restart() {

case "$1" in
        echo "Usage: ${EXE} {start|stop|status|restart}"
        exit 1

exit $?

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