aboutsummaryrefslogtreecommitdiff
path: root/debian/bin
diff options
context:
space:
mode:
authorAJ Jordan <alex@strugee.net>2020-11-29 04:35:22 -0500
committerAJ Jordan <alex@strugee.net>2020-12-04 16:18:26 -0800
commitd251c701b940fc1d7d1f29799785d4bc290b8ce6 (patch)
treef5c939c6ffe3ddaa4581a6dadaa7a1bd3f71a702 /debian/bin
parentb528816b2a59c295ff37b8ca24fbc964094e1272 (diff)
Use systemd-run(1) in restart.sh
systemd-run(1) runs `systemctl restart` in an isolated systemd unit that is not subject to process termination as jellyfin.service is shut down. We adjust the sudoers configuration for this new usage, removing the old config, since restart.sh is the only user of the sudoers policy. Additionally we change `systemctl start` to `systemctl restart` since there was a race condition where jellyfin.service was not fully stopped by the time this ran, so `systemctl start` became a noop. `systemctl restart` on the other hand works whether jellyfin.service is stopped or not. The at(1) hack (and the usage of `start` instead of `restart`) is left in for other init systems since I cannot test on those systems, and because I don't know of any systemd-run(1) equivalent (although it may be a non-issue since alternate init systems do not keep track of daemon children nearly as aggressively as systemd does).
Diffstat (limited to 'debian/bin')
-rwxr-xr-xdebian/bin/restart.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/debian/bin/restart.sh b/debian/bin/restart.sh
index 6aea24ee49..be5ca2c8bd 100755
--- a/debian/bin/restart.sh
+++ b/debian/bin/restart.sh
@@ -43,7 +43,8 @@ fi
echo "Detected service control platform '$cmd'; using it to restart Jellyfin..."
case $cmd in
'systemctl')
- echo "sleep 0.5; $sudo_command systemctl start jellyfin" | at now
+ # Without systemd-run here, `jellyfin.service`'s shutdown terminates this process too
+ $sudo_command systemd-run --scope systemctl restart jellyfin
;;
'service')
echo "sleep 0.5; $sudo_command service jellyfin start" | at now