routeros: Add force option to mqtt publish script

This commit is contained in:
Timo Makinen 2025-04-26 20:04:49 +00:00
parent 8c6974f856
commit 894f69f82f

View file

@ -23,12 +23,14 @@ snmp_get() {
}
# only run script if first vrrp interface is in master state
for state in /run/keepalived/*.state ; do
if [ "$(cat "$state")" != "MASTER" ]; then
exit 0
fi
break
done
if [ "${1:-}" != "-f" ]; then
for state in /run/keepalived/*.state ; do
if [ "$(cat "$state")" != "MASTER" ]; then
exit 0
fi
break
done
fi
ldapsearch -Q -LLL "(&(objectClass=device)(description=MikroTik *))" cn | \
awk '{ if ($1 == "cn:") print $2 }' | while read -r name