]> Git [git.vados.ru] :: Repos - Mikrotiks/ros.vados.ru.git/commitdiff
Auto-commit: AM-Backup-UpdateEmail.rsc manual update on 4/30/2026, 2026-04-30T10...
authorvados-dev <192440777+vados-dev@users.noreply.github.com>
Thu, 30 Apr 2026 10:08:23 +0000 (13:08 +0300)
committervados-dev <192440777+vados-dev@users.noreply.github.com>
Thu, 30 Apr 2026 10:08:23 +0000 (13:08 +0300)
html/AM-Backup-UpdateEmail.rsc

index 888bb38d45d8fdce6b1264f224ea0ef0f72efa2b..7672f80a6cd9d73bb82ca96fe57fae6bcd438a49 100644 (file)
 :global EditSchedulers;\r
 :global OSUpdateMode;\r
 \r
-# :local Comment "Every 7 Day Check For Update and Backup send notification to EMail.";\r
-#  :local Interval "7d 00:00:00";\r
-#  :local StartTime "03:41:27";\r
-#  :local StartDate "jan/01/1970";\r
-#  :local Policy "ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon";\r
+:local SchedComment "Every 7 Day Check For Update and Backup send notification to EMail.";\r
+:local SchedInterval "7d 00:00:00";\r
+\r
+# Function to add or edit schedulers for scripts, to ensure they are set up correctly\r
+# How to use:\r
+# Call this function with the following parameters:\r
+# 1. $1 - Scheduler name (usually same as script name) [*]\r
+# 2. $2 - Comment (optional, default: "Scheduler for script: <name>") [**]\r
+# 3. $3 - Interval (e.g. "1d 00:00:00" (default is "1d")) [**]\r
+# 4. $4 - On Event command (e.g. "/system/script { run <name>; }" (default is "/system/script { run $SchedName; }")) [**]\r
+# 5. $5 - Policy (e.g. "ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon" (default is the same)) [**]\r
+# 6. $6 - Start Date (e.g. "jan/01/1970", default is current date) [**]\r
+# 7. $7 - Start Time (e.g. "03:41:27", default is current time) [**]\r
+# Notes:\r
+# *  - 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).\r
+# ** - If optional parameters are not provided, default values will be used.\r
+#      This allows for quick setup with minimal parameters, while still providing flexibility for customization.\r
+# Example usage:\r
+# :if ([ $EditSchedulers "my-script" ] = false) do={ $LogPrint error $ScriptName ("Failed to add/modify shceduler for " . $ScriptName . "!") }\r
+# :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 . "!") }\r
 \r
 :set EditSchedulers do={\r
   :global LogPrint;\r
     :return true;\r
 }\r
 \r
+:if ([ $EditSchedulers $ScriptName $SchedComment $SchedInterval ] = false) do={\r
+  $LogPrint error $ScriptName ("Failed to add/modify shceduler for " . $ScriptName . "!");\r
+  :set ExitOK false;\r
+  :error true;\r
+}\r
+\r
+\r
 # Add global Function OSUpdateMode\r
 :if ([ :len $OSUpdateMode ] = 0 || ![$OSUpdateMode]) do={\r
   :set OSUpdateMode do={\r