mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Fix restart.sh to look at what's actually booted
The old code was wrong because e.g. systemd can be *installed* on the system, but not actually used as PID1. In that case we would pick `systemctl`, but it wouldn't actually work because PID1 was some other init system.
This commit is contained in:
parent
e936d0872b
commit
a4e1732e35
29
debian/bin/restart.sh
vendored
29
debian/bin/restart.sh
vendored
@ -11,16 +11,29 @@
|
|||||||
#
|
#
|
||||||
# This script is used by the Debian/Ubuntu/Fedora/CentOS packages.
|
# This script is used by the Debian/Ubuntu/Fedora/CentOS packages.
|
||||||
|
|
||||||
get_service_command() {
|
# This is the Right Way(tm) to check if we are booted with
|
||||||
for command in systemctl service; do
|
# systemd, according to sd_booted(3)
|
||||||
if which $command &>/dev/null; then
|
if [ -d /run/systemd/system ]; then
|
||||||
echo $command && return
|
cmd=systemctl
|
||||||
|
else
|
||||||
|
# Everything else is really hard to figure out, so we just use
|
||||||
|
# service(8) if it's available - that works with most init
|
||||||
|
# systems/distributions I know of, including FreeBSD
|
||||||
|
if type service >/dev/null 2>&1; then
|
||||||
|
cmd=service
|
||||||
|
else
|
||||||
|
# If even service(8) isn't available, we just try /etc/init.d
|
||||||
|
# and hope for the best
|
||||||
|
if [ -d /etc/init.d ]; then
|
||||||
|
cmd=sysv
|
||||||
|
else
|
||||||
|
echo "Unable to detect a way to restart Jellyfin; bailing out" 1>&2
|
||||||
|
echo "Please report this bug to https://github.com/jellyfin/jellyfin/issues" 1>&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
fi
|
||||||
echo "sysv"
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
cmd="$( get_service_command )"
|
|
||||||
echo "Detected service control platform '$cmd'; using it to restart Jellyfin..."
|
echo "Detected service control platform '$cmd'; using it to restart Jellyfin..."
|
||||||
case $cmd in
|
case $cmd in
|
||||||
'systemctl')
|
'systemctl')
|
||||||
|
@ -11,16 +11,29 @@
|
|||||||
#
|
#
|
||||||
# This script is used by the Debian/Ubuntu/Fedora/CentOS packages.
|
# This script is used by the Debian/Ubuntu/Fedora/CentOS packages.
|
||||||
|
|
||||||
get_service_command() {
|
# This is the Right Way(tm) to check if we are booted with
|
||||||
for command in systemctl service; do
|
# systemd, according to sd_booted(3)
|
||||||
if which $command &>/dev/null; then
|
if [ -d /run/systemd/system ]; then
|
||||||
echo $command && return
|
cmd=systemctl
|
||||||
|
else
|
||||||
|
# Everything else is really hard to figure out, so we just use
|
||||||
|
# service(8) if it's available - that works with most init
|
||||||
|
# systems/distributions I know of, including FreeBSD
|
||||||
|
if type service >/dev/null 2>&1; then
|
||||||
|
cmd=service
|
||||||
|
else
|
||||||
|
# If even service(8) isn't available, we just try /etc/init.d
|
||||||
|
# and hope for the best
|
||||||
|
if [ -d /etc/init.d ]; then
|
||||||
|
cmd=sysv
|
||||||
|
else
|
||||||
|
echo "Unable to detect a way to restart Jellyfin; bailing out" 1>&2
|
||||||
|
echo "Please report this bug to https://github.com/jellyfin/jellyfin/issues" 1>&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
fi
|
||||||
echo "sysv"
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
cmd="$( get_service_command )"
|
|
||||||
echo "Detected service control platform '$cmd'; using it to restart Jellyfin..."
|
echo "Detected service control platform '$cmd'; using it to restart Jellyfin..."
|
||||||
case $cmd in
|
case $cmd in
|
||||||
'systemctl')
|
'systemctl')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user