mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-03-06 14:09:35 +00:00
Compare commits
3 commits
9f6ade4fe4
...
8fc75e00c4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fc75e00c4 | ||
|
|
2eb3d4d533 | ||
|
|
5bacc4052a |
2 changed files with 28 additions and 23 deletions
|
|
@ -1126,6 +1126,8 @@
|
|||
:global CommitId;
|
||||
:global CommitInfo;
|
||||
:global ExpectedConfigVersion;
|
||||
:global GlobalConfigReady;
|
||||
:global GlobalFunctionsReady;
|
||||
:global Identity;
|
||||
:global IDonate;
|
||||
:global NoNewsAndChangesNotification;
|
||||
|
|
@ -1159,8 +1161,7 @@
|
|||
|
||||
:local CommitIdBefore $CommitId;
|
||||
:local ExpectedConfigVersionBefore $ExpectedConfigVersion;
|
||||
:local ReloadGlobalFunctions false;
|
||||
:local ReloadGlobalConfig false;
|
||||
:local ReloadGlobal false;
|
||||
:local DeviceMode [ /system/device-mode/get ];
|
||||
|
||||
:local CheckSums ({});
|
||||
|
|
@ -1269,31 +1270,25 @@
|
|||
$LogPrint info $0 ("Updating script: " . $ScriptVal->"name");
|
||||
/system/script/set owner=($ScriptVal->"name") \
|
||||
source=[ $IfThenElse ($ScriptUpdatesCRLF = true) $SourceCRLF $SourceNew ] $Script;
|
||||
:if ($ScriptVal->"name" = "global-config") do={
|
||||
:set ReloadGlobalConfig true;
|
||||
}
|
||||
:if ($ScriptVal->"name" = "global-functions" || $ScriptVal->"name" ~ ("^mod/.")) do={
|
||||
:set ReloadGlobalFunctions true;
|
||||
:if ($ScriptVal->"name" = "global-config" || \
|
||||
$ScriptVal->"name" = "global-functions" || \
|
||||
$ScriptVal->"name" ~ ("^mod/.")) do={
|
||||
:set ReloadGlobal true;
|
||||
}
|
||||
} on-error={ }
|
||||
}
|
||||
|
||||
:if ($ReloadGlobalFunctions = true) do={
|
||||
$LogPrint info $0 ("Reloading global functions.");
|
||||
:do {
|
||||
/system/script/run global-functions;
|
||||
} on-error={
|
||||
$LogPrint error $0 ("Reloading global functions failed!");
|
||||
}
|
||||
}
|
||||
:if ($ReloadGlobal = true) do={
|
||||
$LogPrint info $0 ("Reloading global configuration and functions.");
|
||||
:set GlobalConfigReady false;
|
||||
:set GlobalFunctionsReady false;
|
||||
:delay 1s;
|
||||
|
||||
:if ($ReloadGlobalConfig = true) do={
|
||||
$LogPrint info $0 ("Reloading global configuration.");
|
||||
:do {
|
||||
:onerror Err {
|
||||
/system/script/run global-config;
|
||||
} on-error={
|
||||
$LogPrint error $0 ("Reloading global configuration failed!" . \
|
||||
" Syntax error or missing overlay?");
|
||||
/system/script/run global-functions;
|
||||
} do={
|
||||
$LogPrint error $0 ("Reloading global configuration and functions failed! " . $Err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,12 @@
|
|||
:if ($Phone = $Settings->"allowed-number" && \
|
||||
($SmsVal->"message")~("^:cmd " . $Settings->"secret" . " script ")) do={
|
||||
$LogPrint debug $ScriptName ("Removing SMS, which started a script.");
|
||||
/tool/sms/inbox/remove $Sms;
|
||||
:onerror Err {
|
||||
/tool/sms/inbox/remove $Sms;
|
||||
:delay 300ms;
|
||||
} do={
|
||||
$LogPrint warning $ScriptName ("Failed to remove message: " . $Err);
|
||||
}
|
||||
} else={
|
||||
:set Messages ($Messages . "\n\nOn " . $SmsVal->"timestamp" . \
|
||||
" type " . $SmsVal->"type" . ":\n" . $SmsVal->"message");
|
||||
|
|
@ -92,7 +97,12 @@
|
|||
message=("Received " . [ $IfThenElse ($Count = 1) "this message" ("these " . $Count . " messages") ] . \
|
||||
" by " . $Identity . " from " . $Phone . ":" . $Messages) });
|
||||
:foreach Sms in=$Delete do={
|
||||
/tool/sms/inbox/remove $Sms;
|
||||
:onerror Err {
|
||||
/tool/sms/inbox/remove $Sms;
|
||||
:delay 300ms;
|
||||
} do={
|
||||
$LogPrint warning $ScriptName ("Failed to remove message: " . $Err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue