mirror of
https://gh.con.sh/https://github.com/plexinc/pms-docker
synced 2025-04-19 09:46:49 +00:00

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
19 lines
393 B
Plaintext
19 lines
393 B
Plaintext
#!/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
|