aboutsummaryrefslogtreecommitdiff
path: root/monitor_daemon.sh
blob: 7d976ee874fc151f4298634f7b091e5215bcae14 (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
CLIENT="python lab_monitor_client.py"
function on_exit {
    $CLIENT --drop "$JID"
    exit 0
}

JID=$($CLIENT --create "$JMNAME" --type "$JTYPE")
if [[ "$JID" == "" ]]; then
    echo "failed to create monitor"
    exit 1
fi
trap on_exit SIGINT SIGTERM
while [ 1 ]; do
    trigger
    sleep 1
done