Browse Source

Use a service unit, not a scope unit, to restart

Reportedly `systemd-run --scope` still got killed by the service
manager; see #4615. The suspected cause is that `scope` units are run by
the `systemd-run` process itself and inherit the caller's execution
environment (see systemd-run(1)). To fix this, we use a systemd
`service` unit instead, which is run and managed by PID 1 - hopefully
this will isolate us sufficiently so that we don't get terminated along
with `jellyfin.service`.
AJ Jordan 4 years ago
parent
commit
bab389114b
4 changed files with 8 additions and 8 deletions
  1. 1 1
      debian/bin/restart.sh
  2. 3 3
      debian/conf/jellyfin-sudoers
  3. 3 3
      fedora/jellyfin.sudoers
  4. 1 1
      fedora/restart.sh

+ 1 - 1
debian/bin/restart.sh

@@ -44,7 +44,7 @@ echo "Detected service control platform '$cmd'; using it to restart Jellyfin..."
 case $cmd in
     'systemctl')
         # Without systemd-run here, `jellyfin.service`'s shutdown terminates this process too
-        $sudo_command systemd-run --scope systemctl restart jellyfin
+        $sudo_command systemd-run systemctl restart jellyfin
         ;;
     'service')
         echo "sleep 0.5; $sudo_command service jellyfin start" | at now

+ 3 - 3
debian/conf/jellyfin-sudoers

@@ -2,9 +2,9 @@
 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/systemd-run --scope systemctl restart jellyfin
-Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemd-run --scope systemctl start jellyfin
-Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemd-run --scope systemctl stop jellyfin
+Cmnd_Alias RESTARTSERVER_SYSTEMD = /usr/bin/systemd-run systemctl restart jellyfin
+Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemd-run systemctl start jellyfin
+Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemd-run 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

+ 3 - 3
fedora/jellyfin.sudoers

@@ -1,7 +1,7 @@
 # Allow jellyfin group to start, stop and restart itself
-Cmnd_Alias RESTARTSERVER_SYSTEMD = /usr/bin/systemd-run --scope systemctl restart jellyfin
-Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemd-run --scope systemctl start jellyfin
-Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemd-run --scope systemctl stop jellyfin
+Cmnd_Alias RESTARTSERVER_SYSTEMD = /usr/bin/systemd-run systemctl restart jellyfin
+Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemd-run systemctl start jellyfin
+Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemd-run systemctl stop jellyfin
 
 jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSTEMD
 jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSTEMD

+ 1 - 1
fedora/restart.sh

@@ -44,7 +44,7 @@ echo "Detected service control platform '$cmd'; using it to restart Jellyfin..."
 case $cmd in
     'systemctl')
         # Without systemd-run here, `jellyfin.service`'s shutdown terminates this process too
-        $sudo_command systemd-run --scope systemctl restart jellyfin
+        $sudo_command systemd-run systemctl restart jellyfin
         ;;
     'service')
         echo "sleep 0.5; $sudo_command service jellyfin start" | at now