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
for state in /run/keepalived/*.state ; do if [ "${1:-}" != "-f" ]; then
if [ "$(cat "$state")" != "MASTER" ]; then for state in /run/keepalived/*.state ; do
exit 0 if [ "$(cat "$state")" != "MASTER" ]; then
fi exit 0
break fi
done break
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