1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-19 08:13:21 +00:00

Teach the rc script to clean up leftover children

This commit is contained in:
Mark Felder 2015-02-18 15:09:47 +00:00
parent 810871bc96
commit 73ea9714a6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=379208
2 changed files with 19 additions and 2 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= plexmediaserver
PORTVERSION?= 0.9.11.7.803
PORTREVISION?= 0
PORTREVISION?= 1
CATEGORIES= multimedia
MASTER_SITES= http://downloads.plexapp.com/plex-media-server/${PORTVERSION}-${PLEX_BUILD}/ \
http://nightlies.plexapp.com/directdl/plex-media-server/dist-ninja/${PORTVERSION}-${PLEX_BUILD}/

View File

@ -33,8 +33,10 @@ load_rc_config $name
command=/usr/sbin/daemon
procname="%%DATADIR%%/Plex_Media_Server"
command_args="-f ${procname}"
start_precmd=plex_precmd
pidfile=/var/run/plex/plex.pid
start_precmd=plex_precmd
stop_precmd=plex_stop_precmd
stop_postcmd=plex_stop_postcmd
plex_precmd()
{
@ -66,4 +68,19 @@ plex_precmd()
fi
}
plex_stop_precmd()
{
if [ -r ${pidfile} ]; then
export _PLEXPID=$(check_pidfile ${pidfile} ${procname})
fi
}
plex_stop_postcmd()
{
_PLEX_CHILDREN=$(pgrep -g ${_PLEXPID})
echo "Cleaning up leftover child processes."
kill $sig_stop ${_PLEX_CHILDREN}
wait_for_pids ${_PLEX_CHILDREN}
}
run_rc_command "$1"