mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-28 10:02:43 +01:00
7a4fb628fb
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
77 lines
1.5 KiB
Bash
77 lines
1.5 KiB
Bash
#!/bin/sh
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides: Jellyfin Media Server
|
|
# Required-Start:
|
|
# Required-Stop:
|
|
# Default-Start: S
|
|
# Default-Stop:
|
|
# Short-Description: Jellyfin Media Server
|
|
# Description: Runs Jellyfin Media Server
|
|
### END INIT INFO
|
|
|
|
# Load the defaults
|
|
. /etc/default/jellyfin
|
|
|
|
|
|
start() {
|
|
if [ -x /opt/jellyfin/jellyfin/jellyfin ]; then
|
|
if [ "$USER" = "" ]; then
|
|
echo "Starting Jellyfin Media Server"
|
|
/usr/bin/daemon --name=jellyfin --pidfile=/var/run/jellyfin.pid -- \
|
|
/opt/jellyfin/jellyfin/jellyfin \
|
|
-d $DATADIR \
|
|
-C $CACHEDIR \
|
|
-c $CONFIGDIR \
|
|
-l $LOGDIR
|
|
else
|
|
echo "Starting Jellyfin Media Server"
|
|
/usr/bin/daemon --name=jellyfin --pidfile=/var/run/jellyfin.pid -- \
|
|
/opt/jellyfin/jellyfin/jellyfin \
|
|
-d $DATADIR \
|
|
-C $CACHEDIR \
|
|
-c $CONFIGDIR \
|
|
-l $LOGDIR \
|
|
-u $USER:$GROUP
|
|
fi
|
|
fi
|
|
}
|
|
|
|
stop() {
|
|
echo "Stopping Jellyfin Media Server"
|
|
if /usr/bin/daemon --name=jellyfin --pidfile=/var/run/jellyfin.pid --running ; then
|
|
/usr/bin/daemon --name=jellyfin --pidfile=/var/run/jellyfin.pid --stop
|
|
fi
|
|
}
|
|
|
|
restart() {
|
|
echo "Restarting Jellyfin Media Server"
|
|
if /usr/bin/daemon --name=jellyfin --pidfile=/var/run/jellyfin.pid --running ; then
|
|
/usr/bin/daemon --name=jellyfin --pidfile=/var/run/jellyfin.pid --restart
|
|
fi
|
|
}
|
|
|
|
status() {
|
|
/usr/bin/daemon --name=jellyfin --running --pidfile=/var/run/jellyfin.pid --verbose
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
restart)
|
|
restart
|
|
;;
|
|
status)
|
|
status
|
|
;;
|
|
*)
|
|
echo $"Usage: $0 {start|stop|restart|status}"
|
|
exit 1
|
|
esac
|
|
|
|
|
|
|