Compare commits

...

3 Commits

Author SHA1 Message Date
df1d3a83ac Merge branch 'master' of git.lan:chaos/spielplatz 2022-09-19 16:55:33 +02:00
94382ef7c7 domain and powercycle script 2022-09-14 19:57:15 +02:00
31274f3825 adding nummer5 tools 2022-09-14 19:41:27 +02:00
3 changed files with 23 additions and 0 deletions

2
nummer5/hosts.conf Normal file
View File

@@ -0,0 +1,2 @@
hosts="pine01.wks pine02.wks pine03.wks pine04.wks pine05.wks adm01.wks ebin01.wks ebin02.wks"
domain="wks"

View File

@@ -0,0 +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"
${MOSQ} OFF
sleep 2
echo "${host} turning it on"
${MOSQ} ON
ping -W 1 ${host}

9
nummer5/nummer5-hosts-alive.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
. hosts.conf
for host in $hosts; do
if ping -c 1 -W 1 "$host" >/dev/null; then
echo "$host is alive"
else
echo "$host is pining for the fjords"
fi
done