2018-09-26 22:18:43 +00:00
|
|
|
#!rsc
|
2018-07-05 13:29:26 +00:00
|
|
|
# RouterOS script: lease-script
|
|
|
|
# Copyright (c) 2013-2018 Christian Hesse <mail@eworm.de>
|
|
|
|
#
|
|
|
|
# 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;
|
|
|
|
}
|
|
|
|
}
|