aboutsummaryrefslogtreecommitdiff
path: root/monitor_daemon.sh
diff options
context:
space:
mode:
authorDeterminant <ted.sybil@gmail.com>2014-12-27 13:29:20 +0800
committerDeterminant <ted.sybil@gmail.com>2014-12-27 13:29:20 +0800
commit30c896841c65c78cb4cf048c0c26c8e62ee0cf05 (patch)
tree5fb076c5a373b3ffa2e25842f47fe2e64dd7b6bc /monitor_daemon.sh
init
Diffstat (limited to 'monitor_daemon.sh')
-rwxr-xr-xmonitor_daemon.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/monitor_daemon.sh b/monitor_daemon.sh
new file mode 100755
index 0000000..fed2967
--- /dev/null
+++ b/monitor_daemon.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+#if [[ "$#" -eq 0 ]]; then
+# echo "you must specify the triggered command"
+# exit 1
+#fi
+function on_exit {
+ python client.py --drop "$JID"
+ exit 0
+}
+
+JID=$(python client.py --create "$JMNAME" --type "$JTYPE")
+if [[ "$JID" == "" ]]; then
+ echo "failed to create monitor"
+ exit 1
+fi
+trap on_exit SIGINT SIGTERM
+CLIENT="python client.py"
+while [ 1 ]; do
+ trigger
+ sleep 1
+done