Update template

This commit is contained in:
Philip Henning 2026-01-04 02:01:52 +01:00
parent 2f94600859
commit 9d98352e65
2 changed files with 65 additions and 17 deletions

48
doc/template.md Normal file
View file

@ -0,0 +1,48 @@
# Script name
[⬅️ Go back to main README](../README.md)
> **Info**: This script can not be used on its own but requires the base
> installation. See [main README](../README.md) for details.
## Table of Contents
- [Script name](#script-name)
- [Table of Contents](#table-of-contents)
- [Description](#description)
- [Requirements and installation](#requirements-and-installation)
- [Configuration](#configuration)
- [Usage and invocation](#usage-and-invocation)
- [See also](#see-also)
## Description
Function description of the script and which goal it should achieve.
## Requirements and installation
Just install the script:
```rsc
$ScriptInstallUpdate script-file-name-without-filename-extension "base-url=https://git.s1q.dev/phg/routeros-scripts-custom/raw/branch/main/";
```
## Configuration
What to configure to run the script
## Usage and invocation
How to run the script:
```rsc
/system/script/run script-file-name-without-filename-extension;
```
## See also
* ...
---
[⬅️ Go back to main README](../README.md)
[⬆️ Go back to top](#top)

View file

@ -8,26 +8,26 @@
# <short script description>
# https://git.s1q.dev/phg/routeros-scripts-custom/about/doc/<script-filename>.md
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
onerror Err {
:global GlobalConfigReady; :global GlobalFunctionsReady;
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
do={ :error ("Global config and/or functions not ready."); }; } delay=500ms max=50;
:local ScriptName [ :jobname ];
:global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
:global ScriptFromTerminal;
:global SendNotification2;
# Local/global script specific variables
:if ([ $ScriptLock $ScriptName ] = false) do={
:set ExitOK true;
:error false;
# Log notifications locally, or send them via email/pushover etc. when not run from terminal
# Usually used for important notifications only
:if ([ $ScriptFromTerminal $ScriptName ] = true) do={
# Add Script from here for running from terminal:
$LogPrint info $ScriptName ("Hello world!");
} else={
# Add Script from here for running as scheduled script:
$SendNotification2 ({ origin=$ScriptName; subject="Hello..."; message="... world!" });
}
# Add Script from here:
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}
} do={
:global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
}