Multistack launcher
[anna.git] / example / diameter / launcher / resources / scripts / operation_signal.sh
1 #!/bin/bash
2
3 #############
4 # FUNCTIONS #
5 #############
6 _exit () {
7   echo -e "\n$1\n"
8   exit 1
9 }
10
11 #############
12 # EXECUTION #
13 #############
14 cd `dirname $0`
15 echo
16 # Get the PID:
17 [ ! -f .pid ] && _exit "Can't found '`pwd`/.pid'.\nTry to pgrep your process name and dump pid to that file."
18 PID=`cat .pid`
19
20 # Send operation:
21 [ "$1" = "" ] && _exit "Usage: $0 <operation string>; i.e.: $0 help"
22 echo $1 > sigusr2.tasks.input
23 kill -s SIGUSR2 $PID
24
25 sleep 1
26 echo
27 echo
28 echo "You could see results on '`pwd`/sigusr2.tasks.output' file."
29 echo
30 echo
31