From: vados-dev <192440777+vados-dev@users.noreply.github.com> Date: Thu, 30 Apr 2026 10:08:23 +0000 (+0300) Subject: Auto-commit: AM-Backup-UpdateEmail.rsc manual update on 4/30/2026, 2026-04-30T10... X-Git-Url: https://git.vados.ru/gitweb.cgi?a=commitdiff_plain;h=65b0cdf8c784c601d079ad28057d2f9d8e8674a3;p=Mikrotiks%2Fros.vados.ru.git Auto-commit: AM-Backup-UpdateEmail.rsc manual update on 4/30/2026, 2026-04-30T10:08:23.551Z --- diff --git a/html/AM-Backup-UpdateEmail.rsc b/html/AM-Backup-UpdateEmail.rsc index 888bb38d4..7672f80a6 100644 --- a/html/AM-Backup-UpdateEmail.rsc +++ b/html/AM-Backup-UpdateEmail.rsc @@ -20,11 +20,26 @@ :global EditSchedulers; :global OSUpdateMode; -# :local Comment "Every 7 Day Check For Update and Backup send notification to EMail."; -# :local Interval "7d 00:00:00"; -# :local StartTime "03:41:27"; -# :local StartDate "jan/01/1970"; -# :local Policy "ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon"; +:local SchedComment "Every 7 Day Check For Update and Backup send notification to EMail."; +:local SchedInterval "7d 00:00:00"; + +# Function to add or edit schedulers for scripts, to ensure they are set up correctly +# How to use: +# Call this function with the following parameters: +# 1. $1 - Scheduler name (usually same as script name) [*] +# 2. $2 - Comment (optional, default: "Scheduler for script: ") [**] +# 3. $3 - Interval (e.g. "1d 00:00:00" (default is "1d")) [**] +# 4. $4 - On Event command (e.g. "/system/script { run ; }" (default is "/system/script { run $SchedName; }")) [**] +# 5. $5 - Policy (e.g. "ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon" (default is the same)) [**] +# 6. $6 - Start Date (e.g. "jan/01/1970", default is current date) [**] +# 7. $7 - Start Time (e.g. "03:41:27", default is current time) [**] +# Notes: +# * - Scheduler name is required, and is used to identify the scheduler to create or edit. It is usually the same as the script name ($ScriptName). +# ** - If optional parameters are not provided, default values will be used. +# This allows for quick setup with minimal parameters, while still providing flexibility for customization. +# Example usage: +# :if ([ $EditSchedulers "my-script" ] = false) do={ $LogPrint error $ScriptName ("Failed to add/modify shceduler for " . $ScriptName . "!") } +# :if ([ $EditSchedulers "my-script" "My custom comment" "2d 00:00:00" "/system/script { run my-script; }" "ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon" "jan/01/2025" "03:41:27" ] = false) do={ $LogPrint error $ScriptName ("Failed to add/modify shceduler for " . $ScriptName . "!") } :set EditSchedulers do={ :global LogPrint; @@ -71,6 +86,13 @@ :return true; } +:if ([ $EditSchedulers $ScriptName $SchedComment $SchedInterval ] = false) do={ + $LogPrint error $ScriptName ("Failed to add/modify shceduler for " . $ScriptName . "!"); + :set ExitOK false; + :error true; +} + + # Add global Function OSUpdateMode :if ([ :len $OSUpdateMode ] = 0 || ![$OSUpdateMode]) do={ :set OSUpdateMode do={