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=8c9ce856dae049d9b384f73c26c8fedca20a5555;hpb=4c3f0a4d7e4db76996404d80c6f939548fca656f;p=anna.git diff --git a/example/diameter/launcher/resources/scripts/operation_signal.sh b/example/diameter/launcher/resources/scripts/operation_signal.sh index 8c9ce85..c6c15be 100755 --- a/example/diameter/launcher/resources/scripts/operation_signal.sh +++ b/example/diameter/launcher/resources/scripts/operation_signal.sh @@ -17,11 +17,26 @@ cd `dirname $0` PID=`cat .pid` # Send operation: -[ "$1" = "" ] && _exit "Usage: $0 ; i.e.: $0 help" -echo $1 > sigusr2.tasks.input +[ "$1" = "" ] && _exit "Usage: $0 [-f] ; i.e.: $0 help, $0 -f myOperationsList.txt" +FILE= +[ "$1" = "-f" ] && FILE=$2 + +if [ -z "$FILE" ] +then + echo $1 > sigusr2.in +else + [ ! -f "$FILE" ] && _exit "Can't found provided file '$FILE'." + 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 -#echo "You could see results on '`pwd`/sigusr2.tasks.output' file." -cat `pwd`/sigusr2.tasks.output 2>/dev/null -echo +# 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