2018-12-09 16:45:08 -07:00
|
|
|
### BEGIN INIT INFO
|
2018-12-09 15:33:40 -07:00
|
|
|
# Provides: Emby Server
|
|
|
|
# Required-Start: $local_fs $network
|
|
|
|
# Required-Stop: $local_fs
|
2018-12-09 16:45:08 -07:00
|
|
|
# Default-Start: 2 3 4 5
|
|
|
|
# Default-Stop: 0 1 6
|
2018-12-09 15:33:40 -07:00
|
|
|
# Short-Description: Emby Server
|
|
|
|
# Description: Runs Emby Server
|
2018-12-09 16:45:08 -07:00
|
|
|
### END INIT INFO
|
|
|
|
|
2018-12-09 15:33:40 -07:00
|
|
|
# Carry out specific functions when asked to by the system
|
|
|
|
pid=`ps -fA|grep dotnet|grep EmbyServer|awk '{print $2}'| tr -d '\n'`
|
2018-12-09 16:45:08 -07:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
2018-12-09 15:33:40 -07:00
|
|
|
if [ "$pid" == "" ]; then
|
|
|
|
echo "Starting Emby..."
|
|
|
|
nohup dotnet /usr/lib/jellyfin/bin/EmbyServer.dll >/dev/null 2>&1 &
|
|
|
|
else
|
|
|
|
echo "Emby already running"
|
|
|
|
fi
|
2018-12-09 16:45:08 -07:00
|
|
|
;;
|
|
|
|
stop)
|
2018-12-09 15:33:40 -07:00
|
|
|
if [ "$pid" != "" ]; then
|
|
|
|
echo "Stopping Emby..."
|
|
|
|
kill $pid
|
|
|
|
sleep 2
|
|
|
|
else
|
|
|
|
echo "Emby not running"
|
|
|
|
fi
|
2018-12-09 16:45:08 -07:00
|
|
|
;;
|
|
|
|
status)
|
2018-12-09 15:33:40 -07:00
|
|
|
if [ "$pid" != "" ]; then
|
|
|
|
echo "Emby running as $pid"
|
|
|
|
ps -f $pid
|
|
|
|
else
|
|
|
|
echo "Emby is not running"
|
|
|
|
fi
|
|
|
|
;;
|
2018-12-09 16:45:08 -07:00
|
|
|
*)
|
2018-12-09 15:33:40 -07:00
|
|
|
echo "Usage: $0 {start|stop}"
|
|
|
|
exit 1
|
2018-12-09 16:45:08 -07:00
|
|
|
;;
|
|
|
|
esac
|