diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2015-03-03 00:53:59 -0800 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2015-03-03 10:15:44 +0100 |
commit | 096b7e61aa12efe136bd79a5f0e6bc51fa858259 (patch) | |
tree | 0216b0bcb48cc835b294bf5bdafa696a00eed7ec /test | |
parent | f4f83c15401355b93550523d7ad69e2714231503 (diff) |
wrappercheck.sh: enhanced killing of daemon
Occasionally the script shutdown got stuck on Ubuntu Vivid because killing
the background daemon failed although it was still runnning, thus causing the
wait to hang forever.
Not exactly sure what caused this. The enhancement tries to fall back to
killing the process instead of the process group (in case that there is
a race condition, which shouldn't be the case when waiting for the daemon),
preserves stderr from the kill commands and adds ps output when there is
an unexpected failure.
Diffstat (limited to 'test')
-rwxr-xr-x | test/wrappercheck.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/wrappercheck.sh b/test/wrappercheck.sh index 3a3b7af5..357e0639 100755 --- a/test/wrappercheck.sh +++ b/test/wrappercheck.sh @@ -106,10 +106,11 @@ else fi ( set +x; echo >&2 "*** killing and waiting for ${BACKGROUND[0]}" ) -if kill -INT -$BACKGROUND_PID 2>/dev/null && kill -TERM -$BACKGROUND_PID 2>/dev/null; then +if kill -INT -$BACKGROUND_PID >&2 && kill -TERM -$BACKGROUND_PID >&2 || kill -INT $BACKGROUND_PID >&2 && kill -TERM $BACKGROUND_PID >&2; then perl -e "sleep(60); kill(9, -$BACKGROUND_PID);" & KILL_PID=$! else + ps x --forest >&2 KILL_PID= fi set +e |