Optimize
[anna.git] / example / diameter / launcher / resources / scripts / operation_signal.sh
index 85b3111..c6c15be 100755 (executable)
@@ -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
+
 # 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 `pwd`/sigusr2.out
+head --lines=-1 sigusr2.out
 
+exception=$(grep exception sigusr2.out)
+[ $? -eq 0 ] && _exit "(detected 'exception' within operation output)"
+exit 0