slackbuilds/n/calibre-web/rc

56 lines
876 B
Text
Raw Normal View History

2019-10-05 18:18:37 +02:00
#!/bin/bash
#Slackware startup deamon script
2020-02-23 16:58:09 +01:00
USER=RUNNING_USER
2019-10-05 18:18:37 +02:00
DAEMON="python3 /opt/calibre-web/cps.py"
PIDFILE=/var/run/calibre-web.pid
RETVAL=0
status() {
dbpid=`pgrep -fu $USER calibre-web`
if [ -z "$dbpid" ]; then
echo "$DAEMON: NOT running."
else
echo "$DAEMON: running (pid $dbpid)"
fi
}
start() {
echo -n "Starting $DAEMON..."
sudo -u $USER $DAEMON &
RETVAL=$!
echo $RETVAL > $PIDFILE
sleep 1
status
}
stop() {
echo -n "Shutting down $DAEMON..."
/usr/bin/kill $(cat $PIDFILE) && rm $PIDFILE
RETVAL=$?
sleep 1
status
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
RETVAL=1
esac
exit $RETVAL