aboutsummaryrefslogtreecommitdiff
path: root/debian/bin/restart.sh
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-06-13 15:20:13 -0600
committercrobibero <cody@robibe.ro>2020-06-13 15:20:13 -0600
commitbcce8190ffe6cf2b4926c64bca98b8266c0937b0 (patch)
tree7008786b1e0631445437f451cc6422b4be9a5f0d /debian/bin/restart.sh
parent88b6c26472ad57822d3ab79a043db259ffcbb0e3 (diff)
parent0011e8df47380936742302ef40639a4626a780ed (diff)
Merge remote-tracking branch 'upstream/api-migration' into api-channel
Diffstat (limited to 'debian/bin/restart.sh')
-rwxr-xr-xdebian/bin/restart.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/debian/bin/restart.sh b/debian/bin/restart.sh
new file mode 100755
index 000000000..9b64b6d72
--- /dev/null
+++ b/debian/bin/restart.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+# 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.
+
+get_service_command() {
+ for command in systemctl service; do
+ if which $command &>/dev/null; then
+ echo $command && return
+ fi
+ done
+ echo "sysv"
+}
+
+cmd="$( get_service_command )"
+echo "Detected service control platform '$cmd'; using it to restart Jellyfin..."
+case $cmd in
+ 'systemctl')
+ echo "sleep 2; /usr/bin/sudo $( which systemctl ) restart jellyfin" | at now
+ ;;
+ 'service')
+ echo "sleep 2; /usr/bin/sudo $( which service ) jellyfin restart" | at now
+ ;;
+ 'sysv')
+ echo "sleep 2; /usr/bin/sudo /etc/init.d/jellyfin restart" | at now
+ ;;
+esac
+exit 0