diff options
author | Christian Hesse <mail@eworm.de> | 2023-02-17 07:57:10 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2023-02-17 08:05:15 +0100 |
commit | c247fe5a9697bd297d0b1f7645a57f7a6550a58e (patch) | |
tree | 69a891a8d72f599ba0d7b933ddae32f0c1226de8 | |
parent | 49e89070a140a7c991d6e17f0ec1a4f1eb06fa88 (diff) |
README: move configuration down, make it a separate paragraph
-rw-r--r-- | README.d/05-run-and-schedule-scripts.avif (renamed from README.d/06-run-and-schedule-scripts.avif) | bin | 1946 -> 1946 bytes | |||
-rw-r--r-- | README.d/06-schedule-update.avif (renamed from README.d/07-schedule-update.avif) | bin | 2200 -> 2200 bytes | |||
-rw-r--r-- | README.d/07-edit-global-config-overlay.avif (renamed from README.d/05-edit-global-config-overlay.avif) | bin | 5103 -> 5103 bytes | |||
-rw-r--r-- | README.d/08-apply-configuration.avif | bin | 0 -> 2437 bytes | |||
-rw-r--r-- | README.d/09-update-scripts.avif (renamed from README.d/08-update-scripts.avif) | bin | 1733 -> 1733 bytes | |||
-rw-r--r-- | README.d/10-install-scripts.avif (renamed from README.d/09-install-scripts.avif) | bin | 2423 -> 2423 bytes | |||
-rw-r--r-- | README.d/11-schedule-script.avif (renamed from README.d/10-schedule-script.avif) | bin | 1847 -> 1847 bytes | |||
-rw-r--r-- | README.d/12-setup-lease-script.avif (renamed from README.d/11-setup-lease-script.avif) | bin | 1686 -> 1686 bytes | |||
-rw-r--r-- | README.d/13-install-custom-script.avif (renamed from README.d/12-install-custom-script.avif) | bin | 4746 -> 4746 bytes | |||
-rw-r--r-- | README.d/14-remove-script.avif (renamed from README.d/13-remove-script.avif) | bin | 1093 -> 1093 bytes | |||
-rw-r--r-- | README.md | 54 |
11 files changed, 33 insertions, 21 deletions
diff --git a/README.d/06-run-and-schedule-scripts.avif b/README.d/05-run-and-schedule-scripts.avif Binary files differindex 37e1173..37e1173 100644 --- a/README.d/06-run-and-schedule-scripts.avif +++ b/README.d/05-run-and-schedule-scripts.avif diff --git a/README.d/07-schedule-update.avif b/README.d/06-schedule-update.avif Binary files differindex 7c96f3a..7c96f3a 100644 --- a/README.d/07-schedule-update.avif +++ b/README.d/06-schedule-update.avif diff --git a/README.d/05-edit-global-config-overlay.avif b/README.d/07-edit-global-config-overlay.avif Binary files differindex f87fda8..f87fda8 100644 --- a/README.d/05-edit-global-config-overlay.avif +++ b/README.d/07-edit-global-config-overlay.avif diff --git a/README.d/08-apply-configuration.avif b/README.d/08-apply-configuration.avif Binary files differnew file mode 100644 index 0000000..b66af1a --- /dev/null +++ b/README.d/08-apply-configuration.avif diff --git a/README.d/08-update-scripts.avif b/README.d/09-update-scripts.avif Binary files differindex f549fef..f549fef 100644 --- a/README.d/08-update-scripts.avif +++ b/README.d/09-update-scripts.avif diff --git a/README.d/09-install-scripts.avif b/README.d/10-install-scripts.avif Binary files differindex 00225b1..00225b1 100644 --- a/README.d/09-install-scripts.avif +++ b/README.d/10-install-scripts.avif diff --git a/README.d/10-schedule-script.avif b/README.d/11-schedule-script.avif Binary files differindex 27541b7..27541b7 100644 --- a/README.d/10-schedule-script.avif +++ b/README.d/11-schedule-script.avif diff --git a/README.d/11-setup-lease-script.avif b/README.d/12-setup-lease-script.avif Binary files differindex 365e0e8..365e0e8 100644 --- a/README.d/11-setup-lease-script.avif +++ b/README.d/12-setup-lease-script.avif diff --git a/README.d/12-install-custom-script.avif b/README.d/13-install-custom-script.avif Binary files differindex df9f734..df9f734 100644 --- a/README.d/12-install-custom-script.avif +++ b/README.d/13-install-custom-script.avif diff --git a/README.d/13-remove-script.avif b/README.d/14-remove-script.avif Binary files differindex a5c7daf..a5c7daf 100644 --- a/README.d/13-remove-script.avif +++ b/README.d/14-remove-script.avif @@ -91,6 +91,23 @@ Now let's download the main scripts and add them in configuration on the fly. ![screenshot: import scripts](README.d/04-import-scripts.avif) +And finally load configuration and functions and add the scheduler. + + /system/script { run global-config; run global-functions; }; + /system/scheduler/add name="global-scripts" start-time=startup on-event="/system/script { run global-config; run global-functions; }"; + +![screenshot: run and schedule scripts](README.d/05-run-and-schedule-scripts.avif) + +The last step is optional: Add this scheduler **only** if you want the scripts +to be updated automatically! + + /system/scheduler/add name="ScriptInstallUpdate" start-time=startup interval=1d on-event=":global ScriptInstallUpdate; \$ScriptInstallUpdate;"; + +![screenshot: schedule update](README.d/06-schedule-update.avif) + +Editing configuration +--------------------- + The configuration needs to be tweaked for your needs. Edit `global-config-overlay`, copy relevant configuration from [`global-config`](global-config) (the one without `-overlay`). @@ -98,26 +115,21 @@ Save changes and exit with `Ctrl-o`. /system/script/edit global-config-overlay source; -![screenshot: edit global-config-overlay](README.d/05-edit-global-config-overlay.avif) +![screenshot: edit global-config-overlay](README.d/07-edit-global-config-overlay.avif) -> ℹ️ **Info**: It is recommended to edit the configuration using the command -> line interface. If using Winbox on Windows OS, the line endings may be -> missing. To fix this, use the below (to load global functions), then run: -> `/system/script/set source=[ $Unix2Dos [ get global-config-overlay source ] ] global-config-overlay;` +To apply your changes run `global-config`, which will automatically load +the overlay as well: -And finally load configuration and functions and add the scheduler. + /system/script/run global-config; - /system/script { run global-config; run global-functions; }; - /system/scheduler/add name="global-scripts" start-time=startup on-event="/system/script { run global-config; run global-functions; }"; +![screenshot: apply configuration](README.d/08-apply-configuration.avif) -![screenshot: run and schedule scripts](README.d/06-run-and-schedule-scripts.avif) +This last step is required when ever you make changes to your configuration. -The last step is optional: Add this scheduler **only** if you want the scripts -to be updated automatically! - - /system/scheduler/add name="ScriptInstallUpdate" start-time=startup interval=1d on-event=":global ScriptInstallUpdate; \$ScriptInstallUpdate;"; - -![screenshot: schedule update](README.d/07-schedule-update.avif) +> ℹ️ **Info**: It is recommended to edit the configuration using the command +> line interface. If using Winbox on Windows OS, the line endings may be +> missing. To fix this run: +> `/system/script/set source=[ $Unix2Dos [ get global-config-overlay source ] ] global-config-overlay;` Updating scripts ---------------- @@ -127,7 +139,7 @@ everything is up-to-date it will not produce any output. $ScriptInstallUpdate; -![screenshot: update scripts](README.d/08-update-scripts.avif) +![screenshot: update scripts](README.d/09-update-scripts.avif) If the update includes news or requires configuration changes a notification is sent - in addition to terminal output and log messages. @@ -142,7 +154,7 @@ a comma separated list of script names. $ScriptInstallUpdate check-certificates,check-routeros-update; -![screenshot: install scripts](README.d/09-install-scripts.avif) +![screenshot: install scripts](README.d/10-install-scripts.avif) Scheduler and events -------------------- @@ -154,7 +166,7 @@ miss an update. /system/scheduler/add name="check-routeros-update" interval=1h on-event="/system/script/run check-routeros-update;"; -![screenshot: schedule script](README.d/10-schedule-script.avif) +![screenshot: schedule script](README.d/11-schedule-script.avif) Some events can run a script. If you want your DHCP hostnames to be available in DNS use `dhcp-to-dns` with the events from dhcp server. For a regular @@ -164,7 +176,7 @@ cleanup add a scheduler entry. /ip/dhcp-server/set lease-script=lease-script [ find ]; /system/scheduler/add name="dhcp-to-dns" interval=5m on-event="/system/script/run dhcp-to-dns;"; -![screenshot: setup lease script](README.d/11-setup-lease-script.avif) +![screenshot: setup lease script](README.d/12-setup-lease-script.avif) There's much more to explore... Have fun! @@ -235,7 +247,7 @@ This will fetch and install a script `hello-world.rsc` from the given url: $ScriptInstallUpdate hello-world.rsc "base-url=https://git.eworm.de/cgit/routeros-scripts-custom/plain/"; -![screenshot: install custom script](README.d/12-install-custom-script.avif) +![screenshot: install custom script](README.d/13-install-custom-script.avif) For a script to be considered valid it has to begin with a *magic token*. Have a look at [any script](README.d/hello-world.rsc) and copy the first line @@ -272,7 +284,7 @@ configuration... /system/script/remove to-be-removed; -![screenshot: remove script](README.d/13-remove-script.avif) +![screenshot: remove script](README.d/14-remove-script.avif) Possibly a scheduler and other configuration has to be removed as well. |