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