mirror of
https://github.com/gbudny93/RouterOS_Useful_Scripts.git
synced 2025-06-24 10:48:42 +02:00
Initial Commit
This commit is contained in:
parent
71b6bca8fb
commit
dae9b8ac59
2 changed files with 40 additions and 0 deletions
23
RouterOS_Load_Scripts.rsc
Normal file
23
RouterOS_Load_Scripts.rsc
Normal file
|
@ -0,0 +1,23 @@
|
|||
# RouterOS Function
|
||||
# Copyright (c) Grzegorz Budny
|
||||
# Loads function to RouterOS environment
|
||||
|
||||
:global LoadScript do={
|
||||
|
||||
|
||||
:if ([:len [/file find name=$scriptName]] <= 0) do={
|
||||
:log info ($scriptName." not found, make sure file exists!");
|
||||
}
|
||||
|
||||
:if ([:len [/file find name=$scriptName]] > 0) do={
|
||||
:log info ($scriptName." found. Executing!");
|
||||
/system script run $scriptName;
|
||||
:log info ($scriptName." loaded to environment");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$LoadScript scriptName=testScript.rsc;
|
||||
|
||||
|
||||
|
17
RouterOS_Modulo.rsc
Normal file
17
RouterOS_Modulo.rsc
Normal file
|
@ -0,0 +1,17 @@
|
|||
# RouterOS Function
|
||||
# Copyright (c) Grzegorz Budny
|
||||
# Modulo function
|
||||
|
||||
:global Modulo do={
|
||||
|
||||
:local truncated;
|
||||
:local reminder;
|
||||
|
||||
:set $truncated ($number / $modulo);
|
||||
:set $reminder ($number - ($modulo * $truncated));
|
||||
|
||||
:return $reminder
|
||||
|
||||
}
|
||||
|
||||
$Modulo number=5 modulo=2;
|
Loading…
Add table
Add a link
Reference in a new issue