Multistack launcher
[anna.git] / example / diameter / launcher / resources / scripts / operation_signal.sh
diff --git a/example/diameter/launcher/resources/scripts/operation_signal.sh b/example/diameter/launcher/resources/scripts/operation_signal.sh
new file mode 100755 (executable)
index 0000000..c462a7e
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+#############
+# FUNCTIONS #
+#############
+_exit () {
+  echo -e "\n$1\n"
+  exit 1
+}
+
+#############
+# 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 <operation string>; i.e.: $0 help"
+echo $1 > sigusr2.tasks.input
+kill -s SIGUSR2 $PID
+
+sleep 1
+echo
+echo
+echo "You could see results on '`pwd`/sigusr2.tasks.output' file."
+echo
+echo
+