slackbuilds/n/calibre-web/rc

56 lines
867 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..."
kill $(cat $PIDFILE) && rm $PIDFILE
2019-10-05 18:18:37 +02:00
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