routeros-scripts/lease-script

25 lines
631 B
Text
Raw Normal View History

#!rsc
2018-07-05 13:29:26 +00:00
# RouterOS script: lease-script
2019-01-01 20:19:19 +00:00
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
2018-07-05 13:29:26 +00:00
#
# run scripts on DHCP lease
# ( / ip dhcp-server set lease-script=lease-script [ find ] )
2018-10-09 11:08:28 +00:00
:local scripts {
"dhcp-to-dns";
"collect-wireless-mac.local";
"dhcp-lease-comment.local";
"collect-wireless-mac.capsman";
"dhcp-lease-comment.capsman"
}
2018-07-05 13:29:26 +00:00
# delay a second to give time to update the lease table
:delay 1s;
:foreach script in=$scripts do={
2018-11-09 20:28:35 +00:00
:if ([ / system script print count-only where name=$script ] > 0) do={
2018-07-05 13:29:26 +00:00
:log debug ("Running script from lease-script: " . $script);
/ system script run $script;
}
}