Init Script for Calibre Server

I use the very excellent Calibre to make my ebooks accessible to all of my devices anywhere I am. It has a very useful server component that many ebook readers can use to download content. What I was missing was a way to automatically start/stop calibre-server. For that,I put together this rc script for Arch Linux.

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

CONTENT=/mnt/miscellaneous/Books/Literary
PORT=8080

DAEMON=calibre-server
PIDFILE=/var/run/$DAEMON.pid
ARGS="--auto-reload --with-library=$CONTENT --pidfile=$PIDFILE --port=$PORT --daemonize"

case "$1" in
 start)
  stat_busy "Starting $DAEMON"
  [ -z "$PID" ] && $DAEMON $ARGS &>/dev/null
   if [ $? = 0 ]; then
     add_daemon $DAEMON
     stat_done
   else
     stat_fail
     exit 1
   fi
   ;;
 stop)
   stat_busy "Stopping $DAEMON"
   PID=`cat $PIDFILE`
   [ -n "$PID" ] && kill $PID &>/dev/null
   if [ $? = 0 ]; then
     rm_daemon $DAEMON
     stat_done
   else
     stat_fail
     exit 1
   fi
   ;;
 restart)
   $0 stop
   sleep 1
   $0 start
   ;;
 *)
   echo "usage: $0 {start|stop|restart}"
esac

Arch Linux

I decided that I would like to try a Linux distro that was less “do it all for you.” After consulting with the people I consult with on things like that, I decided to try out Arch Linux. So far I am pretty impressed. It is definitely a DIY distribution, but they have documentation to help you through just about everything.

I am running it on an Acer 5672 laptop. I will post here with possible problems I find and any solutions…

  • Special keys (Play/Pause, Stop, Volume, Mute, etc)
  • Card Reader
    • Run the following command: sudo setpci -s 09.0 4c=0x22
  • Webcam
    • Add gspca_vc032x to your modules list in /etc/rc.conf. You can also just modprobe it to test. If compiz is enabled, the picture will flicker unless you modify  your xorg.conf.
    • Section "Device"
      ........
      Option "VideoOverlay" "off"
      Option "OpenGLOverlay" "on"
      Option "TexturedVideo" "off"
      .........
      EndSection
  • No Automounting in Gnome
    • Make sure your /etc/fstab file does not contain entries for the cd/dvd drives. Removing those had it working immediately for me