jellyfin/debian/jellyfin.init

45 lines
1.1 KiB
Plaintext
Raw Normal View History

2018-12-09 23:45:08 +00:00
### BEGIN INIT INFO
# 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
# 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
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
echo "Starting Jellyfin..."
2018-12-09 22:33:40 +00:00
nohup dotnet /usr/lib/jellyfin/bin/EmbyServer.dll >/dev/null 2>&1 &
else
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
echo "Stopping Jellyfin..."
2018-12-09 22:33:40 +00:00
kill $pid
sleep 2
else
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
echo "Jellyfin running as $pid"
2018-12-09 22:33:40 +00:00
ps -f $pid
else
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