commit
811373aa86
@ -1,121 +0,0 @@
|
||||
#!/bin/bash
|
||||
# vim:set ft=sh sw=2 sts=2 st=2 et:
|
||||
# Author: HurricaneHernandez <carlos@techbyte.ca>
|
||||
# Modified for CentOS/Fedora by: FC7 <casasfernando@outlook.com>
|
||||
|
||||
DESC=EmbyServer
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
NAME=emby-server
|
||||
CONF_FILE=/etc/${NAME}.conf
|
||||
DEFAULT_FILE=/etc/default/${NAME}
|
||||
SCRIPTNAME=/usr/bin/emby-server
|
||||
|
||||
# Source Emby server default configuration
|
||||
. $DEFAULT_FILE
|
||||
|
||||
# Source Emby server user configuration overrides
|
||||
if [[ -f $CONF_FILE ]]; then
|
||||
. $CONF_FILE
|
||||
else
|
||||
echo "${CONF_FILE} not found using default settings.";
|
||||
fi
|
||||
|
||||
# Ensure the runas user has restart privilege to restart the service if not try to add the user to emby group. WARN on failure
|
||||
if [[ "$EMBY_USER" != "emby" ]]; then
|
||||
groups $EMBY_USER | grep -q emby
|
||||
if [[ $? -ne 0 ]]; then
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
usermod -a -G emby $EMBY_USER
|
||||
else
|
||||
echo "WARNING: The runas user is not part of emby group and you don't have enough privileges to add it. The restart button in the GUI will probably fail."
|
||||
echo "To solve this start the emby-server service using the startup scripts (systemd/sysv) or"
|
||||
echo "add the runas user ($EMBY_USER) to the emby group manually and restart Emby."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Data directory where Emby database, cache and logs are stored
|
||||
PROGRAMDATA=$EMBY_DATA
|
||||
PROGRAMDATA_OPT="-programdata $PROGRAMDATA"
|
||||
|
||||
# Path to store PID file
|
||||
PIDFILE=$EMBY_PIDFILE
|
||||
|
||||
# Full path of Emby binary
|
||||
EMBY_EXEC=$EMBY_BIN
|
||||
|
||||
# Path of emby program files
|
||||
EMBY_PATH=$EMBY_DIR
|
||||
|
||||
# path to mono bin
|
||||
MONO_EXEC=$MONO_BIN
|
||||
|
||||
# umask
|
||||
UMASK=${UMASK:-002}
|
||||
|
||||
# Mono environment variables
|
||||
MAGICK_HOME_ENV="MAGICK_HOME=${EMBY_PATH}"
|
||||
EMBY_LIBRARY_PATH=$(find /usr/lib/emby-server/ -maxdepth 1 -mindepth 1 -type d| grep -v bin | grep -v etc | grep -v -e "/\.")
|
||||
MAGICK_CODER_FILTER_PATH_ENV="MAGICK_CODER_FILTER_PATH=$(find ${EMBY_LIBRARY_PATH} -type d -name "filters" | grep EmbyMagick)"
|
||||
MAGICK_CODER_MODULE_PATH_ENV="MAGICK_CODER_MODULE_PATH=$(find ${EMBY_LIBRARY_PATH} -type d -name "coders" | grep EmbyMagick)"
|
||||
MONO_EXEC_ENV="$MONO_ENV ${EMBY_LIBRARY_PATH:+"LD_LIBRARY_PATH=${EMBY_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"}"
|
||||
|
||||
# Mono options
|
||||
MONO_EXEC_OPTS=$MONO_OPTS
|
||||
|
||||
# restart function
|
||||
RESTART_OPTS="-restartpath ${EMBY_PATH}/restart.sh"
|
||||
|
||||
# Emby options
|
||||
EMBY_OPTS="$PROGRAMDATA_OPT $RESTART_OPTS $EMBY_ADD_OPTS"
|
||||
|
||||
PID_PATH=$(dirname $PIDFILE)
|
||||
|
||||
# Exit if the mono-sgen not installed
|
||||
if [[ ! -x $MONO_EXEC ]]; then
|
||||
if [[ -n "$(command -v mono-sgen)" ]]; then
|
||||
MONO_EXEC=$(command -v mono-sgen)
|
||||
else
|
||||
MONO_EXEC=$(command -v mono)
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create programdata directory if not exist and ensure the emby user can write to it
|
||||
if [[ ! -d $PROGRAMDATA ]]; then
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
mkdir -p $PROGRAMDATA
|
||||
else
|
||||
echo "WARNING: $EMBY_DATA directory does not exist."
|
||||
echo "To solve this, if it is an upgrade verify that \"EMBY_DATA\" is set to the correct path in /etc/emby-server.conf."
|
||||
echo "You may need to locate the path of your library files and set EMBY_DATA to that path."
|
||||
echo "If this is an new installation please rerun last command with elevated permissions."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set right permission for directories
|
||||
DATA_CURRENT_USER=$(ls -lad $PROGRAMDATA | awk '{print $3}')
|
||||
|
||||
if [[ "$DATA_CURRENT_USER" != "$EMBY_USER" ]]; then
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
chown -R $EMBY_USER.$EMBY_GROUP $PROGRAMDATA
|
||||
else
|
||||
echo "WARNING: $EMBY_DATA directory does not have the correct permissions."
|
||||
echo "Please rerun this script with elevated permissions."
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo $$ > $PIDFILE
|
||||
exec su -s /bin/sh -c 'umask $0; exec "$1" "$@"' $EMBY_USER -- \
|
||||
$UMASK env $MAGICK_HOME_ENV $MAGICK_CODER_FILTER_PATH_ENV $MAGICK_CODER_MODULE_PATH_ENV \
|
||||
$MONO_EXEC_ENV $MONO_EXEC $MONO_EXEC_OPTS $EMBY_EXEC $EMBY_OPTS
|
||||
;;
|
||||
clear)
|
||||
[[ -e $PIDFILE ]] && rm -rf $PIDFILE
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|clear}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
@ -0,0 +1,121 @@
|
||||
#!/bin/bash
|
||||
# vim:set ft=sh sw=2 sts=2 st=2 et:
|
||||
# Author: HurricaneHernandez <carlos@techbyte.ca>
|
||||
# Modified for CentOS/Fedora by: FC7 <casasfernando@outlook.com>
|
||||
|
||||
DESC=Jellyfin
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
NAME=jellyfin
|
||||
CONF_FILE=/etc/${NAME}.conf
|
||||
DEFAULT_FILE=/etc/default/${NAME}
|
||||
SCRIPTNAME=/usr/bin/jellyfin
|
||||
|
||||
# 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
|
||||
|
||||
# Ensure the runas user has restart privilege to restart the service if not try to add the user to jellyfin group. WARN on failure
|
||||
if [[ "$JELLYFIN_USER" != "jellyfin" ]]; then
|
||||
groups $JELLYFIN_USER | grep -q jellyfin
|
||||
if [[ $? -ne 0 ]]; then
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
usermod -a -G jellyfin $JELLYFIN_USER
|
||||
else
|
||||
echo "WARNING: The runas user is not part of jellyfin group and you don't have enough privileges to add it. The restart button in the GUI will probably fail."
|
||||
echo "To solve this start the jellyfin service using the startup scripts (systemd/sysv) or"
|
||||
echo "add the runas user ($JELLYFIN_USER) to the jellyfin group manually and restart Emby."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Data directory where Emby database, cache and logs are stored
|
||||
PROGRAMDATA=$JELLYFIN_DATA
|
||||
PROGRAMDATA_OPT="-programdata $PROGRAMDATA"
|
||||
|
||||
# Path to store PID file
|
||||
PIDFILE=$JELLYFIN_PIDFILE
|
||||
|
||||
# Full path of Emby binary
|
||||
JELLYFIN_EXEC=$JELLYFIN_BIN
|
||||
|
||||
# Path of jellyfin program files
|
||||
JELLYFIN_PATH=$JELLYFIN_DIR
|
||||
|
||||
# path to mono bin
|
||||
MONO_EXEC=$MONO_BIN
|
||||
|
||||
# umask
|
||||
UMASK=${UMASK:-002}
|
||||
|
||||
# Mono environment variables
|
||||
MAGICK_HOME_ENV="MAGICK_HOME=${JELLYFIN_PATH}"
|
||||
JELLYFIN_LIBRARY_PATH=$(find /usr/lib/jellyfin/ -maxdepth 1 -mindepth 1 -type d| grep -v bin | grep -v etc | grep -v -e "/\.")
|
||||
MAGICK_CODER_FILTER_PATH_ENV="MAGICK_CODER_FILTER_PATH=$(find ${JELLYFIN_LIBRARY_PATH} -type d -name "filters" | grep EmbyMagick)"
|
||||
MAGICK_CODER_MODULE_PATH_ENV="MAGICK_CODER_MODULE_PATH=$(find ${JELLYFIN_LIBRARY_PATH} -type d -name "coders" | grep EmbyMagick)"
|
||||
MONO_EXEC_ENV="$MONO_ENV ${JELLYFIN_LIBRARY_PATH:+"LD_LIBRARY_PATH=${JELLYFIN_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"}"
|
||||
|
||||
# Mono options
|
||||
MONO_EXEC_OPTS=$MONO_OPTS
|
||||
|
||||
# restart function
|
||||
RESTART_OPTS="-restartpath ${JELLYFIN_PATH}/restart.sh"
|
||||
|
||||
# Emby options
|
||||
JELLYFIN_OPTS="$PROGRAMDATA_OPT $RESTART_OPTS $JELLYFIN_ADD_OPTS"
|
||||
|
||||
PID_PATH=$(dirname $PIDFILE)
|
||||
|
||||
# Exit if the mono-sgen not installed
|
||||
if [[ ! -x $MONO_EXEC ]]; then
|
||||
if [[ -n "$(command -v mono-sgen)" ]]; then
|
||||
MONO_EXEC=$(command -v mono-sgen)
|
||||
else
|
||||
MONO_EXEC=$(command -v mono)
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create programdata directory if not exist and ensure the jellyfin user can write to it
|
||||
if [[ ! -d $PROGRAMDATA ]]; then
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
mkdir -p $PROGRAMDATA
|
||||
else
|
||||
echo "WARNING: $JELLYFIN_DATA directory does not exist."
|
||||
echo "To solve this, if it is an upgrade verify that \"JELLYFIN_DATA\" is set to the correct path in /etc/jellyfin.conf."
|
||||
echo "You may need to locate the path of your library files and set JELLYFIN_DATA to that path."
|
||||
echo "If this is an new installation please rerun last command with elevated permissions."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set right permission for directories
|
||||
DATA_CURRENT_USER=$(ls -lad $PROGRAMDATA | awk '{print $3}')
|
||||
|
||||
if [[ "$DATA_CURRENT_USER" != "$JELLYFIN_USER" ]]; then
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
chown -R $JELLYFIN_USER.$JELLYFIN_GROUP $PROGRAMDATA
|
||||
else
|
||||
echo "WARNING: $JELLYFIN_DATA directory does not have the correct permissions."
|
||||
echo "Please rerun this script with elevated permissions."
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo $$ > $PIDFILE
|
||||
exec su -s /bin/sh -c 'umask $0; exec "$1" "$@"' $JELLYFIN_USER -- \
|
||||
$UMASK env $MAGICK_HOME_ENV $MAGICK_CODER_FILTER_PATH_ENV $MAGICK_CODER_MODULE_PATH_ENV \
|
||||
$MONO_EXEC_ENV $MONO_EXEC $MONO_EXEC_OPTS $JELLYFIN_EXEC $JELLYFIN_OPTS
|
||||
;;
|
||||
clear)
|
||||
[[ -e $PIDFILE ]] && rm -rf $PIDFILE
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|clear}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
@ -1,37 +0,0 @@
|
||||
#Allow emby group to start, stop and restart itself
|
||||
Cmnd_Alias RESTARTSERVER_SYSV = /sbin/service emby-server restart, /usr/sbin/service emby-server restart
|
||||
Cmnd_Alias STARTSERVER_SYSV = /sbin/service emby-server start, /usr/sbin/service emby-server start
|
||||
Cmnd_Alias STOPSERVER_SYSV = /sbin/service emby-server stop, /usr/sbin/service emby-server stop
|
||||
Cmnd_Alias RESTARTSERVER_SYSTEMD = /usr/bin/systemctl restart emby-server, /bin/systemctl restart emby-server
|
||||
Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemctl start emby-server, /bin/systemctl start emby-server
|
||||
Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemctl stop emby-server, /bin/systemctl stop emby-server
|
||||
Cmnd_Alias RESTARTSERVER_INITD = /etc/init.d/emby-server restart
|
||||
Cmnd_Alias STARTSERVER_INITD = /etc/init.d/emby-server start
|
||||
Cmnd_Alias STOPSERVER_INITD = /etc/init.d/emby-server stop
|
||||
|
||||
|
||||
%emby ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSV
|
||||
%emby ALL=(ALL) NOPASSWD: STARTSERVER_SYSV
|
||||
%emby ALL=(ALL) NOPASSWD: STOPSERVER_SYSV
|
||||
%emby ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSTEMD
|
||||
%emby ALL=(ALL) NOPASSWD: STARTSERVER_SYSTEMD
|
||||
%emby ALL=(ALL) NOPASSWD: STOPSERVER_SYSTEMD
|
||||
%emby ALL=(ALL) NOPASSWD: RESTARTSERVER_INITD
|
||||
%emby ALL=(ALL) NOPASSWD: STARTSERVER_INITD
|
||||
%emby ALL=(ALL) NOPASSWD: STOPSERVER_INITD
|
||||
|
||||
Defaults!RESTARTSERVER_SYSV !requiretty
|
||||
Defaults!STARTSERVER_SYSV !requiretty
|
||||
Defaults!STOPSERVER_SYSV !requiretty
|
||||
Defaults!RESTARTSERVER_SYSTEMD !requiretty
|
||||
Defaults!STARTSERVER_SYSTEMD !requiretty
|
||||
Defaults!STOPSERVER_SYSTEMD !requiretty
|
||||
Defaults!RESTARTSERVER_INITD !requiretty
|
||||
Defaults!STARTSERVER_INITD !requiretty
|
||||
Defaults!STOPSERVER_INITD !requiretty
|
||||
|
||||
#Allow the server to mount iso images
|
||||
%emby ALL=(ALL) NOPASSWD: /bin/mount
|
||||
%emby ALL=(ALL) NOPASSWD: /bin/umount
|
||||
|
||||
Defaults:%emby !requiretty
|
@ -1,24 +0,0 @@
|
||||
# Override defaults for emby initscript
|
||||
# sourced by /etc/init.d/emby-server and /usr/bin/emby-server
|
||||
# installed at /etc/emby-server.conf by the maintainer scripts
|
||||
|
||||
#
|
||||
# This is a POSIX shell fragment
|
||||
#
|
||||
|
||||
## To change the defaults add any of the following settings below the comments
|
||||
##
|
||||
## EMBY_USER= #$EMBY_USER, username to run Emby under, the default is emby
|
||||
## EMBY_GROUP= #$EMBY_GROUP, Emby server group where Emby user belongs
|
||||
## EMBY_DIR= #$EMBY_DIR, the location of Emby program files the default is /usr/lib/emby-server
|
||||
## EMBY_BIN= #$EMBY_BIN, full path of MediaBrowser.Server.Mono.exe the default is /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe
|
||||
## EMBY_DATA= #$EMBY_DATA, the location of Emby data, cache, logs, the default is /var/lib/emby-server
|
||||
## EMBY_PIDFILE= #$EMBY_PIDFILE, the location of emby.pid, the default is /var/run/emby/emby-server.pid
|
||||
## EMBY_ADD_OPTS= #$EMBY_ADD_OPTS, additional options to pass to the Emby server executable, beyond ffmpeg, ffprobe and restart
|
||||
## MONO_BIN= #$MONO_BIN, full path of mono binary, the default is /usr/bin/mono-sgen
|
||||
## MONO_OPTS= #$MONO_OPTS, list of additional options to pass to mono binary
|
||||
## MONO_ENV= #$MONO_ENV, list of environment variables for running mono binary
|
||||
##
|
||||
## EXAMPLE if want to run as different user
|
||||
## add EMBY_USER=username
|
||||
## otherwise default emby is used
|
@ -1,37 +0,0 @@
|
||||
# Defaults for emby initscript
|
||||
# sourced by /etc/init.d/emby-server and /usr/lib/emby-server/emby-server.sh
|
||||
# installed at /etc/default/emby-server by the maintainer scripts
|
||||
|
||||
#
|
||||
# This is a POSIX shell fragment
|
||||
#
|
||||
|
||||
## Don't edit this file
|
||||
## Edit user configuration in /etc/emby-server.conf to change
|
||||
##
|
||||
## EMBY_USER= #$EMBY_USER, username to run Emby under, the default is emby
|
||||
## EMBY_GROUP= #$EMBY_GROUP, Emby server group where Emby user belongs
|
||||
## EMBY_DIR= #$EMBY_DIR, the location of Emby program files the default is /usr/lib/emby-server
|
||||
## EMBY_BIN= #$EMBY_BIN, full path of MediaBrowser.Server.Mono.exe the default is /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe
|
||||
## EMBY_DATA= #$EMBY_DATA, the location of Emby data, cache, logs, the default is /var/lib/emby-server
|
||||
## EMBY_PIDFILE= #$EMBY_PIDFILE, the location of emby.pid, the default is /var/run/emby/emby-server.pid
|
||||
## EMBY_ADD_OPTS= #$EMBY_ADD_OPTS, additional options to pass to the Emby server executable, beyond ffmpeg, ffprobe and restart
|
||||
## MONO_BIN= #$MONO_BIN, full path of mono binary, the default is /usr/bin/mono-sgen
|
||||
## MONO_OPTS= #$MONO_OPTS, list of additional options to pass to mono binary
|
||||
## MONO_ENV= #$MONO_ENV, list of environment variables for running mono binary
|
||||
##
|
||||
## EXAMPLE if want to run as different user
|
||||
## add EMBY_USER=username to /etc/emby-server.conf
|
||||
## otherwise default emby is used
|
||||
|
||||
EMBY_USER="emby"
|
||||
EMBY_GROUP="emby"
|
||||
EMBY_DIR="/usr/lib/emby-server"
|
||||
EMBY_BIN="/usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe"
|
||||
EMBY_DATA="/var/lib/emby-server"
|
||||
EMBY_PIDFILE="/var/run/emby-server.pid"
|
||||
EMBY_ADD_OPTS=""
|
||||
MONO_BIN="/usr/bin/mono-sgen"
|
||||
MONO_OPTS="--optimize=all"
|
||||
MONO_ENV="MONO_THREADS_PER_CPU=250 MONO_GC_PARAMS=nursery-size=128m"
|
||||
UMASK="002"
|
@ -1,88 +0,0 @@
|
||||
#!/bin/bash
|
||||
### BEGIN INIT INFO
|
||||
# Provides: emby-server
|
||||
# Required-Start: $remote_fs $local_fs $network
|
||||
# Required-Stop: $remote_fs $local_fs $network
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: starts instance of Emby
|
||||
# Description: starts instance of Emby
|
||||
### END INIT INFO
|
||||
|
||||
|
||||
# chkconfig: 2345 20 80
|
||||
#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=emby-server
|
||||
CONF_FILE=/etc/${NAME}.conf
|
||||
DEFAULT_FILE=/etc/default/${NAME}
|
||||
|
||||
# Source Emby server default configuration
|
||||
. $DEFAULT_FILE
|
||||
|
||||
# Source Emby server user configuration overrides
|
||||
if [[ -f $CONF_FILE ]]; then
|
||||
. $CONF_FILE
|
||||
else
|
||||
echo "${CONF_FILE} not found using default settings.";
|
||||
fi
|
||||
|
||||
# Path of emby binary
|
||||
EMBYSERVER=/usr/bin/emby-server
|
||||
PIDFILE=${EMBY_PIDFILE-/var/run/emby-server.pid}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_daemon_msg "Starting $NAME daemon"
|
||||
if [[ -s $PIDFILE ]] && [[ -n "$(ps -p $(cat $PIDFILE) -o pid=)" ]]; then
|
||||
log_daemon_msg "apparently already running"
|
||||
log_end_msg 0
|
||||
exit 0
|
||||
fi
|
||||
exec $EMBYSERVER start &
|
||||
sleep 2
|
||||
if [[ -s $PIDFILE ]] && [[ -n "$(ps -p $(cat $PIDFILE) -o pid=)" ]]; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping $NAME daemon"
|
||||
if [[ ! -s $PIDFILE ]] || [[ -z "$(ps -p $(cat $PIDFILE) -o pid=)" ]]; then
|
||||
[[ -e $PIDFILE ]] && rm -rf $PIDFILE
|
||||
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
|
||||
if [[ -z "$(ps -p $PID -o pid=)" ]]; then
|
||||
rm -rf $PIDFILE
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p $PIDFILE "$EMBYSERVER" "$NAME"
|
||||
exit $? # notreached due to set -e
|
||||
;;
|
||||
restart|force-reload)
|
||||
$0 stop || exit $?
|
||||
$0 start || exit $?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/emby-server {start|stop|status|restart|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
@ -1,12 +0,0 @@
|
||||
[Unit]
|
||||
Description=Emby Media Server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/emby-server start
|
||||
Restart=on-abort
|
||||
TimeoutSec=20
|
||||
ExecStopPost=/usr/bin/emby-server clear
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,5 +1,5 @@
|
||||
usr/lib/emby-server usr/lib/
|
||||
debian/emby-server.conf etc/
|
||||
debian/emby etc/sudoers.d/
|
||||
debian/bin/emby-server usr/bin/
|
||||
debian/restart.sh usr/lib/emby-server
|
||||
usr/lib/jellyfin usr/lib/
|
||||
debian/jellyfin.conf etc/
|
||||
debian/jellyfin-sudoers etc/sudoers.d/
|
||||
debian/bin/jellyfin usr/bin/
|
||||
debian/restart.sh usr/lib/jellyfin
|
||||
|
@ -0,0 +1,37 @@
|
||||
#Allow jellyfin group to start, stop and restart itself
|
||||
Cmnd_Alias RESTARTSERVER_SYSV = /sbin/service jellyfin restart, /usr/sbin/service jellyfin restart
|
||||
Cmnd_Alias STARTSERVER_SYSV = /sbin/service jellyfin start, /usr/sbin/service jellyfin start
|
||||
Cmnd_Alias STOPSERVER_SYSV = /sbin/service jellyfin stop, /usr/sbin/service jellyfin stop
|
||||
Cmnd_Alias RESTARTSERVER_SYSTEMD = /usr/bin/systemctl restart jellyfin, /bin/systemctl restart jellyfin
|
||||
Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemctl start jellyfin, /bin/systemctl start jellyfin
|
||||
Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemctl stop jellyfin, /bin/systemctl stop jellyfin
|
||||
Cmnd_Alias RESTARTSERVER_INITD = /etc/init.d/jellyfin restart
|
||||
Cmnd_Alias STARTSERVER_INITD = /etc/init.d/jellyfin start
|
||||
Cmnd_Alias STOPSERVER_INITD = /etc/init.d/jellyfin stop
|
||||
|
||||
|
||||
%jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSV
|
||||
%jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSV
|
||||
%jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_SYSV
|
||||
%jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSTEMD
|
||||
%jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSTEMD
|
||||
%jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_SYSTEMD
|
||||
%jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_INITD
|
||||
%jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_INITD
|
||||
%jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_INITD
|
||||
|
||||
Defaults!RESTARTSERVER_SYSV !requiretty
|
||||
Defaults!STARTSERVER_SYSV !requiretty
|
||||
Defaults!STOPSERVER_SYSV !requiretty
|
||||
Defaults!RESTARTSERVER_SYSTEMD !requiretty
|
||||
Defaults!STARTSERVER_SYSTEMD !requiretty
|
||||
Defaults!STOPSERVER_SYSTEMD !requiretty
|
||||
Defaults!RESTARTSERVER_INITD !requiretty
|
||||
Defaults!STARTSERVER_INITD !requiretty
|
||||
Defaults!STOPSERVER_INITD !requiretty
|
||||
|
||||
#Allow the server to mount iso images
|
||||
%jellyfin ALL=(ALL) NOPASSWD: /bin/mount
|
||||
%jellyfin ALL=(ALL) NOPASSWD: /bin/umount
|
||||
|
||||
Defaults:%jellyfin !requiretty
|
@ -0,0 +1,24 @@
|
||||
# Override defaults for jellyfin initscript
|
||||
# sourced by /etc/init.d/jellyfin and /usr/bin/jellyfin
|
||||
# installed at /etc/jellyfin.conf by the maintainer scripts
|
||||
|
||||
#
|
||||
# This is a POSIX shell fragment
|
||||
#
|
||||
|
||||
## To change the defaults add any of the following settings below the comments
|
||||
##
|
||||
## JELLYFIN_USER= #$JELLYFIN_USER, username to run Emby under, the default is jellyfin
|
||||
## JELLYFIN_GROUP= #$JELLYFIN_GROUP, Jellyfin group where Emby user belongs
|
||||
## JELLYFIN_DIR= #$JELLYFIN_DIR, the location of Emby program files the default is /usr/lib/jellyfin
|
||||
## JELLYFIN_BIN= #$JELLYFIN_BIN, full path of MediaBrowser.Server.Mono.exe the default is /usr/lib/jellyfin/bin/MediaBrowser.Server.Mono.exe
|
||||
## JELLYFIN_DATA= #$JELLYFIN_DATA, the location of Emby data, cache, logs, the default is /var/lib/jellyfin
|
||||
## JELLYFIN_PIDFILE= #$JELLYFIN_PIDFILE, the location of jellyfin.pid, the default is /var/run/jellyfin/jellyfin.pid
|
||||
## JELLYFIN_ADD_OPTS= #$JELLYFIN_ADD_OPTS, additional options to pass to the Jellyfin executable, beyond ffmpeg, ffprobe and restart
|
||||
## MONO_BIN= #$MONO_BIN, full path of mono binary, the default is /usr/bin/mono-sgen
|
||||
## MONO_OPTS= #$MONO_OPTS, list of additional options to pass to mono binary
|
||||
## MONO_ENV= #$MONO_ENV, list of environment variables for running mono binary
|
||||
##
|
||||
## EXAMPLE if want to run as different user
|
||||
## add JELLYFIN_USER=username
|
||||
## otherwise default jellyfin is used
|
@ -0,0 +1,37 @@
|
||||
# Defaults for jellyfin initscript
|
||||
# sourced by /etc/init.d/jellyfin and /usr/lib/jellyfin/jellyfin.sh
|
||||
# installed at /etc/default/jellyfin by the maintainer scripts
|
||||
|
||||
#
|
||||
# This is a POSIX shell fragment
|
||||
#
|
||||
|
||||
## Don't edit this file
|
||||
## Edit user configuration in /etc/jellyfin.conf to change
|
||||
##
|
||||
## JELLYFIN_USER= #$JELLYFIN_USER, username to run Emby under, the default is jellyfin
|
||||
## JELLYFIN_GROUP= #$JELLYFIN_GROUP, Jellyfin group where Emby user belongs
|
||||
## JELLYFIN_DIR= #$JELLYFIN_DIR, the location of Emby program files the default is /usr/lib/jellyfin
|
||||
## JELLYFIN_BIN= #$JELLYFIN_BIN, full path of MediaBrowser.Server.Mono.exe the default is /usr/lib/jellyfin/bin/MediaBrowser.Server.Mono.exe
|
||||
## JELLYFIN_DATA= #$JELLYFIN_DATA, the location of Emby data, cache, logs, the default is /var/lib/jellyfin
|
||||
## JELLYFIN_PIDFILE= #$JELLYFIN_PIDFILE, the location of jellyfin.pid, the default is /var/run/jellyfin/jellyfin.pid
|
||||
## JELLYFIN_ADD_OPTS= #$JELLYFIN_ADD_OPTS, additional options to pass to the Jellyfin executable, beyond ffmpeg, ffprobe and restart
|
||||
## MONO_BIN= #$MONO_BIN, full path of mono binary, the default is /usr/bin/mono-sgen
|
||||
## MONO_OPTS= #$MONO_OPTS, list of additional options to pass to mono binary
|
||||
## MONO_ENV= #$MONO_ENV, list of environment variables for running mono binary
|
||||
##
|
||||
## EXAMPLE if want to run as different user
|
||||
## add JELLYFIN_USER=username to /etc/jellyfin.conf
|
||||
## otherwise default jellyfin is used
|
||||
|
||||
JELLYFIN_USER="jellyfin"
|
||||
JELLYFIN_GROUP="jellyfin"
|
||||
JELLYFIN_DIR="/usr/lib/jellyfin"
|
||||
JELLYFIN_BIN="/usr/lib/jellyfin/bin/MediaBrowser.Server.Mono.exe"
|
||||
JELLYFIN_DATA="/var/lib/jellyfin"
|
||||
JELLYFIN_PIDFILE="/var/run/jellyfin.pid"
|
||||
JELLYFIN_ADD_OPTS=""
|
||||
MONO_BIN="/usr/bin/mono-sgen"
|
||||
MONO_OPTS="--optimize=all"
|
||||
MONO_ENV="MONO_THREADS_PER_CPU=250 MONO_GC_PARAMS=nursery-size=128m"
|
||||
UMASK="002"
|
@ -0,0 +1,44 @@
|
||||
### BEGIN INIT INFO
|
||||
# Provides: Emby Server
|
||||
# Required-Start: $local_fs $network
|
||||
# Required-Stop: $local_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Emby Server
|
||||
# Description: Runs Emby Server
|
||||
### END INIT INFO
|
||||
|
||||
# Carry out specific functions when asked to by the system
|
||||
pid=`ps -fA|grep dotnet|grep EmbyServer|awk '{print $2}'| tr -d '\n'`
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ "$pid" == "" ]; then
|
||||
echo "Starting Emby..."
|
||||
nohup dotnet /usr/lib/jellyfin/bin/EmbyServer.dll >/dev/null 2>&1 &
|
||||
else
|
||||
echo "Emby already running"
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
if [ "$pid" != "" ]; then
|
||||
echo "Stopping Emby..."
|
||||
kill $pid
|
||||
sleep 2
|
||||
else
|
||||
echo "Emby not running"
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
if [ "$pid" != "" ]; then
|
||||
echo "Emby running as $pid"
|
||||
ps -f $pid
|
||||
else
|
||||
echo "Emby is not running"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Jellyfin Media Server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=jellyfin
|
||||
ExecStart=/usr/bin/dotnet /usr/lib/jellyfin/bin/EmbyServer.dll
|
||||
Restart=on-abort
|
||||
TimeoutSec=20
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,3 +1,3 @@
|
||||
# This is an override for the following lintian errors:
|
||||
emby-server source: license-problem-md5sum-non-free-file Emby.Drawing/ImageMagick/fonts/webdings.ttf*
|
||||
emby-server source: source-is-missing
|
||||
jellyfin source: license-problem-md5sum-non-free-file Emby.Drawing/ImageMagick/fonts/webdings.ttf*
|
||||
jellyfin source: source-is-missing
|
||||
|
Loading…
Reference in new issue