diff --git a/nummer5/hosts.conf b/nummer5/hosts.conf index 9ac316e..dc19c38 100644 --- a/nummer5/hosts.conf +++ b/nummer5/hosts.conf @@ -1 +1,2 @@ hosts="pine01.wks pine02.wks pine03.wks pine04.wks pine05.wks adm01.wks ebin01.wks ebin02.wks" +domain="wks" diff --git a/nummer5/nummer5-host-powercycle.sh b/nummer5/nummer5-host-powercycle.sh index d20507b..b890a45 100755 --- a/nummer5/nummer5-host-powercycle.sh +++ b/nummer5/nummer5-host-powercycle.sh @@ -1,10 +1,12 @@ #!/bin/bash +. hosts.conf host=$1 +hostname=$(echo ${host} | sed s/\.${domain}//) +MOSQ="mosquitto_pub -h mqtt.wks -t switch_cloud/switch/${hostname}/command -m" echo "${host} turning it off" -mosquitto_pub -h mqtt.wks -t switch_cloud/switch/${host}/command -m OFF +${MOSQ} OFF sleep 2 echo "${host} turning it on" -mosquitto_pub -h mqtt.wks -t switch_cloud/switch/${host}/command -m ON - +${MOSQ} ON ping -W 1 ${host}