mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: introduce $MkDir
This is a dirty hack... RouterOS does not support creating directories, so we mis-use http server and fetch tool.
This commit is contained in:
parent
98585afe1c
commit
f50e416e49
1 changed files with 18 additions and 0 deletions
|
@ -27,6 +27,7 @@
|
||||||
:global GetRandom;
|
:global GetRandom;
|
||||||
:global LogPrintExit;
|
:global LogPrintExit;
|
||||||
:global MailServerIsUp;
|
:global MailServerIsUp;
|
||||||
|
:global MkDir;
|
||||||
:global ParseKeyValueStore;
|
:global ParseKeyValueStore;
|
||||||
:global RandomDelay;
|
:global RandomDelay;
|
||||||
:global ScriptFromTerminal;
|
:global ScriptFromTerminal;
|
||||||
|
@ -315,6 +316,23 @@
|
||||||
:return false;
|
:return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# create directory
|
||||||
|
:set MkDir do={
|
||||||
|
:local Dir [ :tostr $1 ];
|
||||||
|
|
||||||
|
:global WaitForFile;
|
||||||
|
|
||||||
|
:if ([ / file print count-only where name=$Dir type="directory" ] = 0) do={
|
||||||
|
:local WwwVal [ / ip service get www ];
|
||||||
|
/ ip service set www address=127.0.0.1/32 disabled=no port=80;
|
||||||
|
/ tool fetch http://127.0.0.1/ dst-path=($Dir . "/tmp");
|
||||||
|
$WaitForFile ($Dir . "/tmp");
|
||||||
|
/ file remove ($Dir . "/tmp");
|
||||||
|
/ ip service set www address=($WwwVal->"address") \
|
||||||
|
disabled=($WwwVal->"disabled") port=($WwwVal->"port");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# parse key value store
|
# parse key value store
|
||||||
:set ParseKeyValueStore do={
|
:set ParseKeyValueStore do={
|
||||||
:global CharacterReplace;
|
:global CharacterReplace;
|
||||||
|
|
Loading…
Reference in a new issue