2018-12-09 23:45:08 +00:00
|
|
|
### BEGIN INIT INFO
|
2018-12-10 00:09:43 +00:00
|
|
|
# Provides: Jellyfin Media Server
|
2018-12-09 22:33:40 +00:00
|
|
|
# Required-Start: $local_fs $network
|
|
|
|
# Required-Stop: $local_fs
|
2018-12-09 23:45:08 +00:00
|
|
|
# Default-Start: 2 3 4 5
|
|
|
|
# Default-Stop: 0 1 6
|
2018-12-10 00:09:43 +00:00
|
|
|
# Short-Description: Jellyfin Media Server
|
|
|
|
# Description: Runs Jellyfin Server
|
2018-12-09 23:45:08 +00:00
|
|
|
### END INIT INFO
|
|
|
|
|
2018-12-09 22:33:40 +00:00
|
|
|
# Carry out specific functions when asked to by the system
|
2018-12-15 02:21:48 +00:00
|
|
|
|
|
|
|
pidfile="/var/run/jellyfin.pid"
|
|
|
|
pid=`cat $pidfile`
|
2018-12-09 23:45:08 +00:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
2018-12-09 22:33:40 +00:00
|
|
|
if [ "$pid" == "" ]; then
|
2018-12-10 00:09:43 +00:00
|
|
|
echo "Starting Jellyfin..."
|
2018-12-13 00:14:20 +00:00
|
|
|
. /etc/default/jellyfin
|
2018-12-15 02:21:48 +00:00
|
|
|
nohup su -u $JELLYFIN_USER -c /usr/bin/jellyfin $JELLYFIN_ARGS
|
|
|
|
echo ?? > $pidfile
|
2018-12-09 22:33:40 +00:00
|
|
|
else
|
2018-12-10 00:09:43 +00:00
|
|
|
echo "Jellyfin already running"
|
2018-12-09 22:33:40 +00:00
|
|
|
fi
|
2018-12-09 23:45:08 +00:00
|
|
|
;;
|
|
|
|
stop)
|
2018-12-09 22:33:40 +00:00
|
|
|
if [ "$pid" != "" ]; then
|
2018-12-10 00:09:43 +00:00
|
|
|
echo "Stopping Jellyfin..."
|
2018-12-09 22:33:40 +00:00
|
|
|
kill $pid
|
|
|
|
sleep 2
|
2018-12-15 02:21:48 +00:00
|
|
|
rm -f $pidfile
|
2018-12-09 22:33:40 +00:00
|
|
|
else
|
2018-12-10 00:09:43 +00:00
|
|
|
echo "Jellyfin not running"
|
2018-12-09 22:33:40 +00:00
|
|
|
fi
|
2018-12-09 23:45:08 +00:00
|
|
|
;;
|
|
|
|
status)
|
2018-12-09 22:33:40 +00:00
|
|
|
if [ "$pid" != "" ]; then
|
2018-12-10 00:09:43 +00:00
|
|
|
echo "Jellyfin running as $pid"
|
2018-12-09 22:33:40 +00:00
|
|
|
ps -f $pid
|
|
|
|
else
|
2018-12-10 00:09:43 +00:00
|
|
|
echo "Jellyfin is not running"
|
2018-12-09 22:33:40 +00:00
|
|
|
fi
|
|
|
|
;;
|
2018-12-09 23:45:08 +00:00
|
|
|
*)
|
2018-12-09 22:33:40 +00:00
|
|
|
echo "Usage: $0 {start|stop}"
|
|
|
|
exit 1
|
2018-12-09 23:45:08 +00:00
|
|
|
;;
|
|
|
|
esac
|