26 lines
589 B
Bash
26 lines
589 B
Bash
|
#!/bin/sh
|
||
|
# 2020-12-07, Nico Schottelius
|
||
|
|
||
|
if [ $# -lt 1 ]; then
|
||
|
echo "$0 hostname [hostname...]"
|
||
|
echo " hostname: which mystrom to connect to"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
while [ $# -ge 1 ]; do
|
||
|
hostname=$1; shift
|
||
|
|
||
|
http --json GET "http://${hostname}/report"
|
||
|
curl -s --location \
|
||
|
--request GET \
|
||
|
"http://${hostname}/relay?state=0"
|
||
|
http --json GET "http://${hostname}/report"
|
||
|
echo "Waiting..."
|
||
|
sleep 10
|
||
|
curl -s --location \
|
||
|
--request GET \
|
||
|
"http://${hostname}/relay?state=1"
|
||
|
http --json GET "http://${hostname}/report"
|
||
|
|
||
|
done
|