pms-docker/root/etc/services.d/plex/finish
Nate b8f67a0b3c
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
2020-05-28 07:59:48 -05:00

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