mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: $MkDir: create a tmpfs (RAM disk)...
... if the path starts with "tmpfs/". This helps to mitigate flash wear.
This commit is contained in:
parent
1579330864
commit
16bfe4de7e
|
@ -525,6 +525,7 @@
|
|||
:global CleanFilePath;
|
||||
:global GetRandom20CharAlNum;
|
||||
:global LogPrintExit2;
|
||||
:global RequiredRouterOS;
|
||||
:global WaitForFile;
|
||||
|
||||
:set Path [ $CleanFilePath $Path ];
|
||||
|
@ -547,6 +548,15 @@
|
|||
:set Continue true;
|
||||
}
|
||||
|
||||
:if ($Continue = false && $PathNext = "tmpfs" && [ $RequiredRouterOS $0 "7.7rc1" false ] = true) do={
|
||||
:if ([ :len [ /disk/find where slot=tmpfs type=tmpfs ] ] = 0) do={
|
||||
$LogPrintExit2 info $0 ("Creating disk of type tmpfs.") false;
|
||||
/file/remove [ find where name="tmpfs" type="directory" ];
|
||||
[ :parse "/disk/add slot=tmpfs type=tmpfs;" ];
|
||||
}
|
||||
:set Continue true;
|
||||
}
|
||||
|
||||
:if ($Continue = false && [ :len [ /file/find where name=$PathNext ] ] = 1) do={
|
||||
$LogPrintExit2 warning $0 ("The path '" . $PathNext . "' exists, but is not a directory.") false;
|
||||
:return false;
|
||||
|
|
Loading…
Reference in a new issue