From 54645f4ba5ea14fb8ec2bdb5a0a45f3da9151061 Mon Sep 17 00:00:00 2001
From: Evan Pratten <evan@ewpratten.com>
Date: Tue, 25 Jun 2024 15:50:29 -0400
Subject: [PATCH] Misc home scripts

---
 scripts/home-get-temperatures |  4 ++++
 scripts/rebuild-udm-dns       | 11 +++++++++++
 2 files changed, 15 insertions(+)
 create mode 100755 scripts/home-get-temperatures
 create mode 100755 scripts/rebuild-udm-dns

diff --git a/scripts/home-get-temperatures b/scripts/home-get-temperatures
new file mode 100755
index 0000000..50bd776
--- /dev/null
+++ b/scripts/home-get-temperatures
@@ -0,0 +1,4 @@
+#! /bin/bash
+set -e
+
+http get "http://prometheus.vpn:9090/api/v1/query?query=home_controller_sensor_temperature_None" | jq -r '.data.result.[] | "\(.metric.friendly_name): \(.value.[1])°C"'
diff --git a/scripts/rebuild-udm-dns b/scripts/rebuild-udm-dns
new file mode 100755
index 0000000..03a50a8
--- /dev/null
+++ b/scripts/rebuild-udm-dns
@@ -0,0 +1,11 @@
+#! /bin/bash
+# Home router gives up on custom DNS configs sometimes. This script rebuilds them
+set -e
+
+echo "SSH-ing into the router to make changes.."
+ssh root@10.80.0.1 <<EOF
+echo "server=/vpn/10.10.0.1" > /run/dnsmasq.conf.d/local_custom_dns.conf;
+echo "server=/0.10.10.in-addr.arpa/10.10.0.1" >> /run/dnsmasq.conf.d/local_custom_dns.conf;
+kill \$(cat /run/dnsmasq.pid)
+dig gateway.vpn
+EOF