Kill process groups in screen_stop()

Previously only the top child process was killed, killing the process
group also takes all of the child processes with it.

Closes-bug: 1271889
Change-Id: If1864cc4f1944f417ea3473d81d8b6e8e40030c2
This commit is contained in:
Dean Troyer 2014-01-23 11:32:22 -06:00
parent 6d323f43b4
commit 579af5d678

View File

@ -1150,6 +1150,9 @@ function screen_it {
# Stop a service in screen
# If a PID is available use it, kill the whole process group via TERM
# If screen is being used kill the screen window; this will catch processes
# that did not leave a PID behind
# screen_stop service
function screen_stop() {
SCREEN_NAME=${SCREEN_NAME:-stack}
@ -1159,7 +1162,7 @@ function screen_stop() {
if is_service_enabled $1; then
# Kill via pid if we have one available
if [[ -r $SERVICE_DIR/$SCREEN_NAME/$1.pid ]]; then
pkill -TERM -P $(cat $SERVICE_DIR/$SCREEN_NAME/$1.pid)
pkill -TERM -P -$(cat $SERVICE_DIR/$SCREEN_NAME/$1.pid)
rm $SERVICE_DIR/$SCREEN_NAME/$1.pid
fi
if [[ "$USE_SCREEN" = "True" ]]; then