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
Brian,
I want to keep calibre running all the time – I have selected my local newspaper to be downloaded at 6 AM and sent to my email address. This is done automatically by calibre.
I want calibre to auto start when I start gnome.
I don’t seem to be able to do this.
I put this in an executable file in my home folder in a file called
~/.config/autostart/calibre
Inside this file I put:
#!/bin/sh
exec /usr/bin/calibre
Then I chmod the file to make it executable.
But it doesn’t start calibre!
Do you know how I can get calibre to autostart so it downloads my newspaper?
Thanks!
David