mirror of
https://gh.con.sh/https://github.com/plexinc/pms-docker
synced 2025-04-17 21:54:33 +00:00
Stop plex service with the s6 supervisor (#53)
S6 will now send SIGTERM to the root Plex process as a part of the service's finish script. If the processes don't exit after 5 seconds, all processes are sent a SIGKILL
This commit is contained in:
parent
f4e62e8dd4
commit
b8f67a0b3c
18
root/etc/services.d/plex/finish
Normal file
18
root/etc/services.d/plex/finish
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# Copied from the init.d stop method from non-Dockerized Plex.
|
||||
|
||||
echo "Stopping Plex Media Server."
|
||||
|
||||
# Ask nicely
|
||||
pids="$(ps -ef | grep 'Plex Media Server' | grep -v grep | awk '{print $2}')"
|
||||
kill -15 $pids
|
||||
|
||||
sleep 5
|
||||
|
||||
# Stuck
|
||||
pids="$(ps -ef | grep /usr/lib/plexmediaserver | grep -v grep | awk '{print $2}')"
|
||||
|
||||
if [ "$pids" != "" ]; then
|
||||
kill -9 $pids
|
||||
sleep 2
|
||||
fi
|
1
root/etc/services.d/plex/timeout-finish
Normal file
1
root/etc/services.d/plex/timeout-finish
Normal file
|
@ -0,0 +1 @@
|
|||
8000
|
7
root/plex_service.sh
Executable file
7
root/plex_service.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ "$#" -eq 1 ]; then
|
||||
s6-svc "$1" /var/run/s6/services/plex
|
||||
else
|
||||
echo "No argument supplied; must be -u, -d, or -r."
|
||||
fi
|
Loading…
Reference in New Issue
Block a user