aboutsummaryrefslogtreecommitdiff
path: root/monitor_daemon.sh
blob: fed29675cb8279cdf8a2b3571c10c4c77fc9e9fd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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