X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Fresources%2Fscripts%2Foperation_signal.sh;h=c6c15bebcc1a26bdbed3dc3b01896797caea87bc;hb=ec48516a195faabbb514298ad743520b3fdb7ee4;hp=4db01a51403fbc97177aaa6cb456797c19c92848;hpb=f9534159f3b43cbf74eccf88723ee740c69eb204;p=anna.git diff --git a/example/diameter/launcher/resources/scripts/operation_signal.sh b/example/diameter/launcher/resources/scripts/operation_signal.sh index 4db01a5..c6c15be 100755 --- a/example/diameter/launcher/resources/scripts/operation_signal.sh +++ b/example/diameter/launcher/resources/scripts/operation_signal.sh @@ -29,8 +29,14 @@ else grep -v "^#" $FILE | sed '/^[ \t]*$/d' > sigusr2.in fi 0> sigusr2.out +kill -0 $PID 2>/dev/null +[ $? -ne 0 ] && _exit "Operation error: missing process with pid $PID" kill -s SIGUSR2 $PID -count=0 -while [ ! -s sigusr2.out -a $count -lt 500 ]; do sleep 0.01; count=$((count+1)); done -cat `pwd`/sigusr2.out +# Detect EOF and print all except that last line: +while [ -z "$(tail -1 sigusr2.out | grep ^EOF)" ]; do sleep 0.1; done +head --lines=-1 sigusr2.out + +exception=$(grep exception sigusr2.out) +[ $? -eq 0 ] && _exit "(detected 'exception' within operation output)" +exit 0