From ac8a9a758e71f5c29391b6e411693aaf1581ec3b Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Sun, 25 Nov 2018 19:35:54 +1100 Subject: [PATCH] Check that at least the pid belongs to a java process before killing it --- bin/bpipe | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bin/bpipe b/bin/bpipe index b2ba2342..3afd9de1 100755 --- a/bin/bpipe +++ b/bin/bpipe @@ -107,6 +107,19 @@ is_running() { # Sets LAST_PID get_last_run_pid + # Check that the pid actually belongs to a running bpipe + PID_IS_BPIPE=0 + for PID in $(pidof java); do + if [ "x$LAST_PID" == "x$PID" ]; + then + PID_IS_BPIPE=1 + fi + done + if [ $PID_IS_BPIPE == 0 ]; + then + LAST_PID="-1" + fi + # Never run before? if [ "$LAST_PID" == "-1" ]; then