#!/bin/bash host=$1 echo "${host} turning it off" mosquitto_pub -h mqtt.wks -t switch_cloud/switch/${host}/command -m OFF sleep 2 echo "${host} turning it on" mosquitto_pub -h mqtt.wks -t switch_cloud/switch/${host}/command -m ON ping -W 1 ${host}