summaryrefslogtreecommitdiff
path: root/.clusterman_onoff.sh
blob: 75f40dcc6f5706012ec91b4fa7344e1429c334e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash
# This script assumes that the keys used by publishers
# corresponds to the UNIQUE hostname of each monitored node

# Check parameters
[ $# -ne 1 ] && { echo "Usage: $0 [on|off]"; exit 1; }
if [ "$1" != "on" ]
then
    [ "$1" != "off" ] && { echo "Usage: $0 [on|off]"; exit 1; }
fi

# Load configuration
wai=$(dirname $(readlink -f "$0")) # Current script directory
source ${wai}/config.mk
source ${wai}/.clusterman.sh.conf

# Loop over names
for value in "${nodes[@]}"; do
    node=$(echo "$value"|cut -d "/" -f 1)
    ina260=$(echo "$value"|cut -d "/" -f 2)
    ip=$(clusterman node list -g $node)
    [ $? -ne 0 ] && { echo "$ip"; exit 1; }
    [ "$1" == "off" ] && ssh testbed@${ip} touch ina260-zmq-publisher/publisher_${ina260}_break
    [ "$1" == "on" ] && ssh testbed@${ip} rm -f ina260-zmq-publisher/publisher_${ina260}_break
done