Files
spielplatz/nummer5/nummer5-host-powercycle.sh

13 lines
268 B
Bash
Executable File

#!/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"
${MOSQ} OFF
sleep 2
echo "${host} turning it on"
${MOSQ} ON
ping -W 1 ${host}