mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-28 10:02:43 +01:00
7e74048754
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
55 lines
1.2 KiB
Bash
55 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
# rc.serviio - script to run with slackware
|
|
|
|
# Location of serviio.sh
|
|
SERVIIO_CMD=/opt/serviio/bin/serviio.sh
|
|
|
|
# The user Serviio should run under
|
|
SERVIIO_USER=serviio
|
|
|
|
# pid file used
|
|
PIDFILE=/var/run/serviio/serviio.pid
|
|
|
|
# stop/start functions
|
|
|
|
start() {
|
|
if [ -f "$PIDFILE" ] ; then
|
|
echo "Serviio DNLA server already running or incorrectly stopped!"
|
|
echo "If Serviio DNLA server isn't running, please check if"
|
|
echo "$PIDFILE exists and delete it."
|
|
else
|
|
echo 'Starting Serviio DNLA server...'
|
|
mkdir -p $(dirname ${PIDFILE})
|
|
chown ${SERVIIO_USER} $(dirname ${PIDFILE})
|
|
setpriv --reset-env --reuid ${SERVIIO_USER} ${SERVIIO_CMD}
|
|
fi
|
|
}
|
|
|
|
stop(){
|
|
if [ -f "$PIDFILE" ] ; then
|
|
echo "Stopping Serviio DNLA server..."
|
|
kill -9 $(<"$PIDFILE")
|
|
if [ -f "$PIDFILE" ] ; then
|
|
rm "$PIDFILE"
|
|
fi
|
|
else
|
|
echo "Serviio DNLA server isn't running or $PIDFILE file is absent!"
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
'start')
|
|
start
|
|
;;
|
|
'stop')
|
|
stop
|
|
;;
|
|
'restart')
|
|
stop
|
|
start
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart}"
|
|
;;
|
|
esac
|