mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-16 21:14:29 +02:00
mod/notification-email: $FlushEmailQueue: move the check up...
... as this needs to be done before creating a scheduler. 😜
Also remove the scheduler and return.
This commit is contained in:
parent
1e2ca3d214
commit
8c8c75ca66
1 changed files with 6 additions and 4 deletions
|
@ -47,6 +47,12 @@
|
||||||
:local QueueLen [ :len $EmailQueue ];
|
:local QueueLen [ :len $EmailQueue ];
|
||||||
:local Scheduler [ /system/scheduler/find where name="_FlushEmailQueue" ];
|
:local Scheduler [ /system/scheduler/find where name="_FlushEmailQueue" ];
|
||||||
|
|
||||||
|
:if ([ :len $Scheduler ] > 0 && $QueueLen = 0) do={
|
||||||
|
$LogPrint warning $0 ("Flushing E-Mail messages from scheduler, but queue is empty.");
|
||||||
|
/system/scheduler/remove $Scheduler;
|
||||||
|
:return false;
|
||||||
|
}
|
||||||
|
|
||||||
:if ([ :len $Scheduler ] < 0) do={
|
:if ([ :len $Scheduler ] < 0) do={
|
||||||
/system/scheduler/add name="_FlushEmailQueue" interval=1m start-time=startup \
|
/system/scheduler/add name="_FlushEmailQueue" interval=1m start-time=startup \
|
||||||
comment="Doing initial checks..." on-event=(":global FlushEmailQueue; \$FlushEmailQueue;");
|
comment="Doing initial checks..." on-event=(":global FlushEmailQueue; \$FlushEmailQueue;");
|
||||||
|
@ -74,10 +80,6 @@
|
||||||
:return false;
|
:return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :len $Scheduler ] > 0 && $QueueLen = 0) do={
|
|
||||||
$LogPrint warning $0 ("Flushing E-Mail messages from scheduler, but queue is empty.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/system/scheduler/set interval=($QueueLen . "m") comment="Sending..." $Scheduler;
|
/system/scheduler/set interval=($QueueLen . "m") comment="Sending..." $Scheduler;
|
||||||
|
|
||||||
:foreach Id,Message in=$EmailQueue do={
|
:foreach Id,Message in=$EmailQueue do={
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue