domain and powercycle script
This commit is contained in:
@@ -1 +1,2 @@
|
||||
hosts="pine01.wks pine02.wks pine03.wks pine04.wks pine05.wks adm01.wks ebin01.wks ebin02.wks"
|
||||
domain="wks"
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user