mirror of
https://codeberg.org/gwh/slackbuilds.git
synced 2024-11-16 19:51:19 +01:00
include rc script to start calibre as a server
This commit is contained in:
parent
8d8a518595
commit
4e8263f472
2 changed files with 74 additions and 1 deletions
|
@ -22,6 +22,9 @@ mkdir -p $PKG/usr/bin
|
|||
|
||||
$PKG/opt/calibre/calibre_postinstall --root=$PKG/usr
|
||||
|
||||
mkdir -p $PKG/etc/rc.d/
|
||||
cp $CWD/rc.calibre-server $PKG/etc/rc.d/
|
||||
|
||||
cd $PKG/usr/bin
|
||||
find . -type l -exec sh -c 'rm "$1"; ln -s ../../opt/calibre/$(basename $1)' _ {} \;
|
||||
|
||||
|
@ -34,7 +37,7 @@ cat <<EOF > $PKG/install/slack-desc
|
|||
# make exactly 11 lines for the formatting to be correct. It's also
|
||||
# customary to leave one space after the ':'.
|
||||
|
||||
|-----handy-ruler------------------------------------------------------|
|
||||
|-----handy-ruler------------------------------------------------------|
|
||||
${PRGNAM}: ${PRGNAM} (e-book library management application)
|
||||
${PRGNAM}:
|
||||
${PRGNAM}: ${PRGNAM} is meant to be a complete e-library solution.
|
||||
|
|
70
xap/calibre/rc.calibre-server
Normal file
70
xap/calibre/rc.calibre-server
Normal file
|
@ -0,0 +1,70 @@
|
|||
#!/bin/bash
|
||||
|
||||
CALIBRE_LIBRARY_PATH="/home/cycojesus/BKP/tibou/Documents/eBooks/Livres/"
|
||||
PIDFILE=/tmp/calibre-server.pid
|
||||
USER=cycojesus
|
||||
PORT=8081
|
||||
|
||||
start() {
|
||||
echo "Starting Calibre server..."
|
||||
su $USER -c "calibre-server --with-library=\"$CALIBRE_LIBRARY_PATH\" -p $PORT --pidfile=$PIDFILE --daemonize" &
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Could not start calibre-server."
|
||||
fi
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo "Stopping Calibre server..."
|
||||
if [ -e $PIDFILE ]; then
|
||||
read PID < $PIDFILE
|
||||
ps aux | grep "$PID" | grep 'calibre-server' > /dev/null
|
||||
RUNNING=$?
|
||||
if [ $RUNNING -eq 0 ]; then
|
||||
kill $PID
|
||||
if [ $? -eq 0 ]; then
|
||||
rm $PIDFILE
|
||||
fi
|
||||
else
|
||||
echo "Could not find a calibre-server process with PID $PID."
|
||||
fi
|
||||
else
|
||||
echo "Could not find pidfile: $PIDFILE"
|
||||
fi
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
status() {
|
||||
if [ -e $PIDFILE ]; then
|
||||
read PID < $PIDFILE
|
||||
echo "calibre-server is running with PID $PID."
|
||||
else
|
||||
echo "calibre-server is not running."
|
||||
fi
|
||||
}
|
||||
|
||||
unknown() {
|
||||
echo "Unrecognized command: $1"
|
||||
echo "Try one of the following: (start|stop|restart|status)"
|
||||
}
|
||||
|
||||
case $1 in
|
||||
start )
|
||||
start
|
||||
;;
|
||||
stop )
|
||||
stop
|
||||
;;
|
||||
restart )
|
||||
restart
|
||||
;;
|
||||
status )
|
||||
status
|
||||
;;
|
||||
* )
|
||||
unknown
|
||||
;;
|
||||
esac
|
Loading…
Reference in a new issue