From c16680bd04f8321a5bc9a0827275ca37d5f2f8fa Mon Sep 17 00:00:00 2001 From: Jeff Culverhouse Date: Tue, 18 Nov 2025 11:02:53 -0500 Subject: [PATCH] chore: add clear.sh tool for clearing retained messages in MQTT broker --- .gitignore | 1 - tools/clear.sh | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100755 tools/clear.sh diff --git a/.gitignore b/.gitignore index 2c15bab..8e95f74 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,6 @@ npm-debug.log NOTES coverage/ dist/ -tools/ # Apple .DS_Store diff --git a/tools/clear.sh b/tools/clear.sh new file mode 100755 index 0000000..a683c3f --- /dev/null +++ b/tools/clear.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +mosquitto_sub -h mosquitto.graystorm.com -v -t '#' --retained-only \ + | grep 'amcrest2mqtt' \ + | while read -r topic payload ; do + mosquitto_pub -h mosquitto.graystorm.com -t "$topic" -n -r + echo "Purged $topic" + done +echo "done."