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-10 00:09:43 +00:00
|
|
|
pid=`ps -fA|grep dotnet|grep JellyfinServer|awk '{print $2}'| tr -d '\n'`
|
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-09 22:33:40 +00:00
|
|
|
nohup dotnet /usr/lib/jellyfin/bin/EmbyServer.dll >/dev/null 2>&1 &
|
|
|
|
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
|
|
|
|
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
|