16 [ ! -f .pid ] && _exit "Can't found '`pwd`/.pid'.\nTry to pgrep your process name and dump pid to that file."
20 [ "$1" = "" ] && _exit "Usage: $0 [-f] <content: operation string or file (one operation per line) if '-f' provided>; i.e.: $0 help, $0 -f myOperationsList.txt"
22 [ "$1" = "-f" ] && FILE=$2
28 [ ! -f "$FILE" ] && _exit "Can't found provided file '$FILE'."
29 grep -v "^#" $FILE | sed '/^[ \t]*$/d' > sigusr2.in
32 kill -0 $PID 2>/dev/null
33 [ $? -ne 0 ] && _exit "Operation error: missing process with pid $PID"
36 # Detect EOF and print all except that last line:
37 while [ -z "$(tail -1 sigusr2.out | grep ^EOF)" ]; do sleep 0.1; done
38 head --lines=-1 sigusr2.out
40 exception=$(grep exception sigusr2.out)
41 [ $? -eq 0 ] && _exit "(detected 'exception' within operation output)"