mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-04-18 19:19:36 +00:00
Compare commits
21 commits
2dc82118aa
...
125d96da9f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
125d96da9f | ||
|
|
041e15dbaf | ||
|
|
c10838d58e | ||
|
|
346113dfb7 | ||
|
|
bc384f8802 | ||
|
|
c7636cc9e5 | ||
|
|
91f641a59f | ||
|
|
abc02d8a94 | ||
|
|
2014517439 | ||
|
|
0b4a1d88e0 | ||
|
|
a5248c7df1 | ||
|
|
7708666ffd | ||
|
|
6e050ed984 | ||
|
|
f8eff5b795 | ||
|
|
beb0798bd5 | ||
|
|
27f374ff88 | ||
|
|
b418c69a88 | ||
|
|
396bfe511f | ||
|
|
460d105588 | ||
|
|
0d84476d31 | ||
|
|
d755b74345 |
7 changed files with 40 additions and 29 deletions
|
|
@ -35,6 +35,7 @@ Add yourself to the list,
|
|||
[donate with PayPal ↗️](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)!
|
||||
|
||||
* Abdul Mannan Abbasi
|
||||
* Alex Maier
|
||||
* Andrea Ruffini Perico
|
||||
* Andrew Cox
|
||||
* Christoph Boss (@Kampfwurst)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@
|
|||
:global LogPrint;
|
||||
:global MkDir;
|
||||
:global RandomDelay;
|
||||
:global RmDir;
|
||||
:global ScriptFromTerminal;
|
||||
:global ScriptLock;
|
||||
:global SendEMail2;
|
||||
|
|
@ -128,7 +127,8 @@
|
|||
# wait for the mail to be sent
|
||||
:do {
|
||||
:retry {
|
||||
:if ([ $FileExists ($FilePath . ".backup") "backup" ] = true || \
|
||||
:if ([ $FileExists ($FilePath . ".conf") ".conf file" ] = true || \
|
||||
[ $FileExists ($FilePath . ".backup") "backup" ] = true || \
|
||||
[ $FileExists ($FilePath . ".rsc") "script" ] = true) do={
|
||||
:error "Files are still available.";
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@
|
|||
$LogPrint warning $ScriptName ("Files are still available, sending e-mail failed.");
|
||||
:set PackagesUpdateBackupFailure true;
|
||||
}
|
||||
$RmDir $DirName;
|
||||
# do not remove the files here, as the mail is still queued!
|
||||
} do={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
:global CleanFilePath;
|
||||
:global DownloadPackage;
|
||||
:global FileGet;
|
||||
:global LogPrint;
|
||||
:global MkDir;
|
||||
:global RmFile;
|
||||
|
|
@ -42,9 +43,7 @@
|
|||
:error false;
|
||||
}
|
||||
|
||||
:do {
|
||||
/file/get $PackagePath;
|
||||
} on-error={
|
||||
:if ([ $FileGet $PackagePath ] = false) do={
|
||||
:if ([ $MkDir $PackagePath ] = false) do={
|
||||
$LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
|
||||
$PackagePath . ") failed!");
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
:global CleanFilePath;
|
||||
:global DownloadPackage;
|
||||
:global FileGet;
|
||||
:global LogPrint;
|
||||
:global MkDir;
|
||||
:global RmFile;
|
||||
|
|
@ -44,9 +45,7 @@
|
|||
:error false;
|
||||
}
|
||||
|
||||
:do {
|
||||
/file/get $PackagePath;
|
||||
} on-error={
|
||||
:if ([ $FileGet $PackagePath ] = false) do={
|
||||
:if ([ $MkDir $PackagePath ] = false) do={
|
||||
$LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
|
||||
$PackagePath . ") failed!");
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
:global CleanFilePath;
|
||||
:global DownloadPackage;
|
||||
:global FileGet;
|
||||
:global LogPrint;
|
||||
:global MkDir;
|
||||
:global RmFile;
|
||||
|
|
@ -42,9 +43,7 @@
|
|||
:error false;
|
||||
}
|
||||
|
||||
:do {
|
||||
/file/get $PackagePath;
|
||||
} on-error={
|
||||
:if ([ $FileGet $PackagePath ] = false) do={
|
||||
:if ([ $MkDir $PackagePath ] = false) do={
|
||||
$LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
|
||||
$PackagePath . ") failed!");
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ Configuration
|
|||
|
||||
The configuration goes to `global-config-overlay`, this is the only parameter:
|
||||
|
||||
* `PackagesUpdateDeferReboot`: defer the reboot for night (between 3 AM
|
||||
and 5 AM)
|
||||
* `PackagesUpdateDeferReboot`: defer the reboot for night (between 3 AM and
|
||||
5 AM), use a numerical value in days suffixed with a `d` to defer further
|
||||
|
||||
By modifying the scheduler's `start-time` you can force the reboot at
|
||||
different time.
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
:global FetchHuge;
|
||||
:global FetchUserAgentStr;
|
||||
:global FileExists;
|
||||
:global FileGet;
|
||||
:global FormatLine;
|
||||
:global FormatMultiLines;
|
||||
:global GetMacVendor;
|
||||
|
|
@ -536,10 +537,10 @@
|
|||
:local FileName [ :tostr $1 ];
|
||||
:local Type [ :tostr $2 ];
|
||||
|
||||
:local FileVal;
|
||||
:do {
|
||||
:set FileVal [ /file/get $FileName ];
|
||||
} on-error={
|
||||
:global FileGet;
|
||||
|
||||
:local FileVal [ $FileGet $FileName ];
|
||||
:if ($FileVal = false) do={
|
||||
:return false;
|
||||
}
|
||||
|
||||
|
|
@ -554,6 +555,20 @@
|
|||
:return false;
|
||||
}
|
||||
|
||||
# get file properties in array, or false on error
|
||||
:set FileGet do={
|
||||
:local FileName [ :tostr $1 ];
|
||||
|
||||
:local FileVal;
|
||||
:do {
|
||||
:set FileVal [ /file/get $FileName ];
|
||||
} on-error={
|
||||
:return false;
|
||||
}
|
||||
|
||||
:return $FileVal;
|
||||
}
|
||||
|
||||
# format a line for output
|
||||
:set FormatLine do={
|
||||
:local Key [ :tostr $1 ];
|
||||
|
|
@ -905,6 +920,7 @@
|
|||
:local Path [ :tostr $1 ];
|
||||
|
||||
:global CleanFilePath;
|
||||
:global FileGet;
|
||||
:global LogPrint;
|
||||
:global RmDir;
|
||||
:global WaitForFile;
|
||||
|
|
@ -942,9 +958,8 @@
|
|||
|
||||
$LogPrint debug $0 ("Making directory: " . $Path);
|
||||
|
||||
:local PathVal;
|
||||
:do { :set PathVal [ /file/get $Path ]; } on-error={ }
|
||||
:if ($PathVal->"type"="directory") do={
|
||||
:local PathVal [ $FileGet $Path ];
|
||||
:if ($PathVal->"type" = "directory") do={
|
||||
$LogPrint debug $0 ("... which already exists.");
|
||||
:return true;
|
||||
}
|
||||
|
|
@ -1069,14 +1084,13 @@
|
|||
:set RmDir do={
|
||||
:local DirName [ :tostr $1 ];
|
||||
|
||||
:global FileGet;
|
||||
:global LogPrint;
|
||||
|
||||
$LogPrint debug $0 ("Removing directory: ". $DirName);
|
||||
|
||||
:local DirVal;
|
||||
:do {
|
||||
:set DirVal [ /file/get $DirName ];
|
||||
} on-error={
|
||||
:local DirVal [ $FileGet $DirName ];
|
||||
:if ($DirVal = false) do={
|
||||
$LogPrint debug $0 ("... which does not exist.");
|
||||
:return true;
|
||||
}
|
||||
|
|
@ -1099,14 +1113,13 @@
|
|||
:set RmFile do={
|
||||
:local FileName [ :tostr $1 ];
|
||||
|
||||
:global FileGet;
|
||||
:global LogPrint;
|
||||
|
||||
$LogPrint debug $0 ("Removing file: ". $FileName);
|
||||
|
||||
:local FileVal;
|
||||
:do {
|
||||
:set FileVal [ /file/get $FileName ];
|
||||
} on-error={
|
||||
:local FileVal [ $FileGet $FileName ];
|
||||
:if ($FileVal = false) do={
|
||||
$LogPrint debug $0 ("... which does not exist.");
|
||||
:return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue