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