X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Fresources%2Fscripts%2Foperation_signal.sh;h=85b31112b4a0e44518b0aaa0a63261bcac8700eb;hb=983eaadca6cfae987be3453853d75bb9bce04487;hp=c462a7ea9bdf5421015a6ec1e2dd5abaec020800;hpb=431d322261ecfd6ef354abb392edbf8987e2407a;p=anna.git diff --git a/example/diameter/launcher/resources/scripts/operation_signal.sh b/example/diameter/launcher/resources/scripts/operation_signal.sh index c462a7e..85b3111 100755 --- a/example/diameter/launcher/resources/scripts/operation_signal.sh +++ b/example/diameter/launcher/resources/scripts/operation_signal.sh @@ -12,20 +12,25 @@ _exit () { # EXECUTION # ############# cd `dirname $0` -echo # Get the PID: [ ! -f .pid ] && _exit "Can't found '`pwd`/.pid'.\nTry to pgrep your process name and dump pid to that file." PID=`cat .pid` # Send operation: -[ "$1" = "" ] && _exit "Usage: $0 ; i.e.: $0 help" -echo $1 > sigusr2.tasks.input -kill -s SIGUSR2 $PID +[ "$1" = "" ] && _exit "Usage: $0 [-f] ; i.e.: $0 help, $0 -f myOperationsList.txt" +FILE= +[ "$1" = "-f" ] && FILE=$2 -sleep 1 -echo -echo -echo "You could see results on '`pwd`/sigusr2.tasks.output' file." -echo -echo +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 -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