summaryrefslogtreecommitdiff
path: root/.clusterman_onoff.sh
blob: 2f951d8feff926da4be2f61c60ad5687ea6c6a25 (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
#!/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)
    [ "$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