Debian Init Script for https://bitbucket.org/raphaelmutschler/calibreserver
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: bookserver | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Python Book Server | |
# Description: Python Book Server for Calibre Database | |
# Author: Typomedia Foundation | |
# Version: 1.4 | |
### END INIT INFO | |
PATH=/bin:/usr/bin:/sbin:/usr/sbin | |
DIR=/usr/local/bin/cps | |
DESC="Python Book Server" | |
NAME=bookserver | |
DAEMON=/usr/bin/python | |
PIDFILE=/var/run/$NAME.pid | |
OPTIONS=$DIR/cps.py | |
USER=root | |
. /lib/lsb/init-functions | |
daemon_start () { | |
start-stop-daemon --start --background \ | |
--make-pidfile --pidfile $PIDFILE --chdir $DIR \ | |
--user $USER --chuid $USER --exec $DAEMON -- $OPTIONS | |
} | |
daemon_stop () { | |
#start-stop-daemon --stop --pidfile $PIDFILE --retry 10 | |
kill $(ps aux | grep '[p]ython /usr/local/bin/cps/cps.py' | awk '{print $2}') | |
} | |
case "$1" in | |
start) | |
log_daemon_msg "Starting $DESC" "$NAME" | |
daemon_start | |
log_end_msg $? | |
;; | |
stop) | |
log_daemon_msg "Stopping $DESC" "$NAME" | |
daemon_stop | |
log_end_msg $? | |
;; | |
restart|reload|force-reload) | |
log_daemon_msg "Restarting $DESC" "$NAME" | |
daemon_stop | |
sleep 1 | |
daemon_start | |
log_end_msg $? | |
;; | |
status) | |
status_of_proc "$DAEMON" "$DESC" && exit 0 || exit $? | |
;; | |
*) | |
log_action_msg "Usage: service $NAME {start|stop|restart|status}" || true | |
exit 2 | |
;; | |
esac | |
exit 0 |
This comment has been minimized.
This comment has been minimized.
add #!/usr/bin/env python in cps.py |
This comment has been minimized.
This comment has been minimized.
update-rc.d bookserver defaults 92 |
This comment has been minimized.
This comment has been minimized.
update-rc.d -f bookserver remove |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
http://pantofflhelden.com/2014/01/raspberry-pi-ein-eigener-ebook-server/