Update services to work with dotnet
This commit is contained in:
parent
919f685e79
commit
c591b6d751
90
debian/jellyfin.init
vendored
90
debian/jellyfin.init
vendored
|
@ -1,88 +1,44 @@
|
||||||
#!/bin/bash
|
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: jellyfin
|
# Provides: Emby Server
|
||||||
# Required-Start: $remote_fs $local_fs $network
|
# Required-Start: $local_fs $network
|
||||||
# Required-Stop: $remote_fs $local_fs $network
|
# Required-Stop: $local_fs
|
||||||
# Default-Start: 2 3 4 5
|
# Default-Start: 2 3 4 5
|
||||||
# Default-Stop: 0 1 6
|
# Default-Stop: 0 1 6
|
||||||
# Short-Description: starts instance of Emby
|
# Short-Description: Emby Server
|
||||||
# Description: starts instance of Emby
|
# Description: Runs Emby Server
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
|
# Carry out specific functions when asked to by the system
|
||||||
# chkconfig: 2345 20 80
|
pid=`ps -fA|grep dotnet|grep EmbyServer|awk '{print $2}'| tr -d '\n'`
|
||||||
#The above indicates that the script should be started in levels 2, 3, 4, and 5, #that its start priority should be 20, and that its stop priority should be 80.
|
|
||||||
# Load the VERBOSE setting and other rcS variables
|
|
||||||
. /lib/init/vars.sh
|
|
||||||
|
|
||||||
# Define LSB log_* functions.
|
|
||||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
|
||||||
. /lib/lsb/init-functions
|
|
||||||
|
|
||||||
NAME=jellyfin
|
|
||||||
CONF_FILE=/etc/${NAME}.conf
|
|
||||||
DEFAULT_FILE=/etc/default/${NAME}
|
|
||||||
|
|
||||||
# Source Jellyfin default configuration
|
|
||||||
. $DEFAULT_FILE
|
|
||||||
|
|
||||||
# Source Jellyfin user configuration overrides
|
|
||||||
if [[ -f $CONF_FILE ]]; then
|
|
||||||
. $CONF_FILE
|
|
||||||
else
|
|
||||||
echo "${CONF_FILE} not found using default settings.";
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Path of jellyfin binary
|
|
||||||
JELLYFINSERVER=/usr/bin/jellyfin
|
|
||||||
PIDFILE=${JELLYFIN_PIDFILE-/var/run/jellyfin.pid}
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
log_daemon_msg "Starting $NAME daemon"
|
if [ "$pid" == "" ]; then
|
||||||
if [[ -s $PIDFILE ]] && [[ -n "$(ps -p $(cat $PIDFILE) -o pid=)" ]]; then
|
echo "Starting Emby..."
|
||||||
log_daemon_msg "apparently already running"
|
nohup dotnet /usr/lib/jellyfin/bin/EmbyServer.dll >/dev/null 2>&1 &
|
||||||
log_end_msg 0
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
exec $JELLYFINSERVER start &
|
|
||||||
sleep 2
|
|
||||||
if [[ -s $PIDFILE ]] && [[ -n "$(ps -p $(cat $PIDFILE) -o pid=)" ]]; then
|
|
||||||
log_end_msg 0
|
|
||||||
else
|
else
|
||||||
log_end_msg 1
|
echo "Emby already running"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
log_daemon_msg "Stopping $NAME daemon"
|
if [ "$pid" != "" ]; then
|
||||||
if [[ ! -s $PIDFILE ]] || [[ -z "$(ps -p $(cat $PIDFILE) -o pid=)" ]]; then
|
echo "Stopping Emby..."
|
||||||
[[ -e $PIDFILE ]] && rm -rf $PIDFILE
|
kill $pid
|
||||||
log_success_msg "apparently already stopped"
|
|
||||||
log_end_msg 0
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
PID=$(cat $PIDFILE)
|
|
||||||
CPIDS=$(pgrep -P $PID)
|
|
||||||
sleep 2 && kill -KILL $CPIDS
|
|
||||||
kill -TERM $CPIDS > /dev/null 2>&1
|
|
||||||
sleep 2
|
sleep 2
|
||||||
if [[ -z "$(ps -p $PID -o pid=)" ]]; then
|
|
||||||
rm -rf $PIDFILE
|
|
||||||
log_end_msg 0
|
|
||||||
else
|
else
|
||||||
log_end_msg 1
|
echo "Emby not running"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
status_of_proc -p $PIDFILE "$JELLYFINSERVER" "$NAME"
|
if [ "$pid" != "" ]; then
|
||||||
exit $? # notreached due to set -e
|
echo "Emby running as $pid"
|
||||||
;;
|
ps -f $pid
|
||||||
restart|force-reload)
|
else
|
||||||
$0 stop || exit $?
|
echo "Emby is not running"
|
||||||
$0 start || exit $?
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: /etc/init.d/jellyfin {start|stop|status|restart|force-reload}" >&2
|
echo "Usage: $0 {start|stop}"
|
||||||
exit 3
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
4
debian/jellyfin.service
vendored
4
debian/jellyfin.service
vendored
|
@ -3,10 +3,10 @@ Description=Jellyfin Media Server
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/bin/jellyfin start
|
User=jellyfin
|
||||||
|
ExecStart=/usr/bin/dotnet /usr/lib/jellyfin/bin/EmbyServer.dll
|
||||||
Restart=on-abort
|
Restart=on-abort
|
||||||
TimeoutSec=20
|
TimeoutSec=20
|
||||||
ExecStopPost=/usr/bin/jellyfin clear
|
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
5
debian/jellyfin.upstart
vendored
5
debian/jellyfin.upstart
vendored
|
@ -16,8 +16,5 @@ script
|
||||||
# Log file
|
# Log file
|
||||||
logger -t "$0" "DEBUG: `set`"
|
logger -t "$0" "DEBUG: `set`"
|
||||||
exec /usr/bin/jellyfin start
|
exec /usr/bin/jellyfin start
|
||||||
end script
|
exec /usr/bin/dotnet /usr/lib/jellyfin/bin/EmbyServer.dll
|
||||||
|
|
||||||
post-stop script
|
|
||||||
exec /usr/bin/jellyfin clear
|
|
||||||
end script
|
end script
|
||||||
|
|
Loading…
Reference in New Issue
Block a user