mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-13 11:34:31 +02:00
global-functions: add error handling
This commit is contained in:
parent
11d43e9fe5
commit
c980699dd7
1 changed files with 13 additions and 5 deletions
|
@ -485,15 +485,23 @@
|
|||
|
||||
:set Dir [ $CleanFilePath $Dir ];
|
||||
|
||||
:if ([ :len [ / file find 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;
|
||||
:if ([ :len [ / file find where name=$Dir type="directory" ] ] = 1) do={
|
||||
:return true;
|
||||
}
|
||||
|
||||
:local Return true;
|
||||
:local WwwVal [ / ip service get www ];
|
||||
/ ip service set www address=127.0.0.1/32 disabled=no port=80;
|
||||
:do {
|
||||
/ 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");
|
||||
} on-error={
|
||||
:set Return false;
|
||||
}
|
||||
/ ip service set www address=($WwwVal->"address") \
|
||||
disabled=($WwwVal->"disabled") port=($WwwVal->"port");
|
||||
:return $Return;
|
||||
}
|
||||
|
||||
# parse key value store
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue