2019-01-11 22:35:14 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-06-27 22:05:03 +00:00
|
|
|
# restart.sh - Jellyfin server restart script
|
|
|
|
# Part of the Jellyfin project (https://github.com/jellyfin)
|
|
|
|
#
|
|
|
|
# This script restarts the Jellyfin daemon on Linux when using
|
|
|
|
# the Restart button on the admin dashboard. It supports the
|
|
|
|
# systemctl, service, and traditional /etc/init.d (sysv) restart
|
|
|
|
# methods, chosen automatically by which one is found first (in
|
|
|
|
# that order).
|
|
|
|
#
|
|
|
|
# This script is used by the Debian/Ubuntu/Fedora/CentOS packages.
|
2019-01-11 22:35:14 +00:00
|
|
|
|
2019-06-27 22:05:03 +00:00
|
|
|
get_service_command() {
|
|
|
|
for command in systemctl service; do
|
|
|
|
if which $command &>/dev/null; then
|
|
|
|
echo $command && return
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "sysv"
|
|
|
|
}
|
2019-01-11 22:35:14 +00:00
|
|
|
|
2019-06-27 22:05:03 +00:00
|
|
|
cmd="$( get_service_command )"
|
|
|
|
echo "Using system control command '$cmd' to restart Jellyfin..."
|
|
|
|
case $cmd in
|
|
|
|
'systemctl')
|
|
|
|
echo "sleep 2; /usr/bin/sudo /usr/bin/systemctl restart jellyfin" | at now
|
|
|
|
;;
|
|
|
|
'service')
|
|
|
|
echo "sleep 2; /usr/bin/sudo /sbin/service jellyfin restart" | at now
|
|
|
|
;;
|
|
|
|
'sysv')
|
|
|
|
echo "sleep 2; /usr/bin/sudo /etc/init.d/jellyfin restart" | at now
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
exit 0
|