From c247fe5a9697bd297d0b1f7645a57f7a6550a58e Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 17 Feb 2023 07:57:10 +0100 Subject: README: move configuration down, make it a separate paragraph --- README.d/05-edit-global-config-overlay.avif | Bin 5103 -> 0 bytes README.d/05-run-and-schedule-scripts.avif | Bin 0 -> 1946 bytes README.d/06-run-and-schedule-scripts.avif | Bin 1946 -> 0 bytes README.d/06-schedule-update.avif | Bin 0 -> 2200 bytes README.d/07-edit-global-config-overlay.avif | Bin 0 -> 5103 bytes README.d/07-schedule-update.avif | Bin 2200 -> 0 bytes README.d/08-apply-configuration.avif | Bin 0 -> 2437 bytes README.d/08-update-scripts.avif | Bin 1733 -> 0 bytes README.d/09-install-scripts.avif | Bin 2423 -> 0 bytes README.d/09-update-scripts.avif | Bin 0 -> 1733 bytes README.d/10-install-scripts.avif | Bin 0 -> 2423 bytes README.d/10-schedule-script.avif | Bin 1847 -> 0 bytes README.d/11-schedule-script.avif | Bin 0 -> 1847 bytes README.d/11-setup-lease-script.avif | Bin 1686 -> 0 bytes README.d/12-install-custom-script.avif | Bin 4746 -> 0 bytes README.d/12-setup-lease-script.avif | Bin 0 -> 1686 bytes README.d/13-install-custom-script.avif | Bin 0 -> 4746 bytes README.d/13-remove-script.avif | Bin 1093 -> 0 bytes README.d/14-remove-script.avif | Bin 0 -> 1093 bytes README.md | 54 +++++++++++++++++----------- 20 files changed, 33 insertions(+), 21 deletions(-) delete mode 100644 README.d/05-edit-global-config-overlay.avif create mode 100644 README.d/05-run-and-schedule-scripts.avif delete mode 100644 README.d/06-run-and-schedule-scripts.avif create mode 100644 README.d/06-schedule-update.avif create mode 100644 README.d/07-edit-global-config-overlay.avif delete mode 100644 README.d/07-schedule-update.avif create mode 100644 README.d/08-apply-configuration.avif delete mode 100644 README.d/08-update-scripts.avif delete mode 100644 README.d/09-install-scripts.avif create mode 100644 README.d/09-update-scripts.avif create mode 100644 README.d/10-install-scripts.avif delete mode 100644 README.d/10-schedule-script.avif create mode 100644 README.d/11-schedule-script.avif delete mode 100644 README.d/11-setup-lease-script.avif delete mode 100644 README.d/12-install-custom-script.avif create mode 100644 README.d/12-setup-lease-script.avif create mode 100644 README.d/13-install-custom-script.avif delete mode 100644 README.d/13-remove-script.avif create mode 100644 README.d/14-remove-script.avif diff --git a/README.d/05-edit-global-config-overlay.avif b/README.d/05-edit-global-config-overlay.avif deleted file mode 100644 index f87fda8..0000000 Binary files a/README.d/05-edit-global-config-overlay.avif and /dev/null differ diff --git a/README.d/05-run-and-schedule-scripts.avif b/README.d/05-run-and-schedule-scripts.avif new file mode 100644 index 0000000..37e1173 Binary files /dev/null and b/README.d/05-run-and-schedule-scripts.avif differ diff --git a/README.d/06-run-and-schedule-scripts.avif b/README.d/06-run-and-schedule-scripts.avif deleted file mode 100644 index 37e1173..0000000 Binary files a/README.d/06-run-and-schedule-scripts.avif and /dev/null differ diff --git a/README.d/06-schedule-update.avif b/README.d/06-schedule-update.avif new file mode 100644 index 0000000..7c96f3a Binary files /dev/null and b/README.d/06-schedule-update.avif differ diff --git a/README.d/07-edit-global-config-overlay.avif b/README.d/07-edit-global-config-overlay.avif new file mode 100644 index 0000000..f87fda8 Binary files /dev/null and b/README.d/07-edit-global-config-overlay.avif differ diff --git a/README.d/07-schedule-update.avif b/README.d/07-schedule-update.avif deleted file mode 100644 index 7c96f3a..0000000 Binary files a/README.d/07-schedule-update.avif and /dev/null differ diff --git a/README.d/08-apply-configuration.avif b/README.d/08-apply-configuration.avif new file mode 100644 index 0000000..b66af1a Binary files /dev/null and b/README.d/08-apply-configuration.avif differ diff --git a/README.d/08-update-scripts.avif b/README.d/08-update-scripts.avif deleted file mode 100644 index f549fef..0000000 Binary files a/README.d/08-update-scripts.avif and /dev/null differ diff --git a/README.d/09-install-scripts.avif b/README.d/09-install-scripts.avif deleted file mode 100644 index 00225b1..0000000 Binary files a/README.d/09-install-scripts.avif and /dev/null differ diff --git a/README.d/09-update-scripts.avif b/README.d/09-update-scripts.avif new file mode 100644 index 0000000..f549fef Binary files /dev/null and b/README.d/09-update-scripts.avif differ diff --git a/README.d/10-install-scripts.avif b/README.d/10-install-scripts.avif new file mode 100644 index 0000000..00225b1 Binary files /dev/null and b/README.d/10-install-scripts.avif differ diff --git a/README.d/10-schedule-script.avif b/README.d/10-schedule-script.avif deleted file mode 100644 index 27541b7..0000000 Binary files a/README.d/10-schedule-script.avif and /dev/null differ diff --git a/README.d/11-schedule-script.avif b/README.d/11-schedule-script.avif new file mode 100644 index 0000000..27541b7 Binary files /dev/null and b/README.d/11-schedule-script.avif differ diff --git a/README.d/11-setup-lease-script.avif b/README.d/11-setup-lease-script.avif deleted file mode 100644 index 365e0e8..0000000 Binary files a/README.d/11-setup-lease-script.avif and /dev/null differ diff --git a/README.d/12-install-custom-script.avif b/README.d/12-install-custom-script.avif deleted file mode 100644 index df9f734..0000000 Binary files a/README.d/12-install-custom-script.avif and /dev/null differ diff --git a/README.d/12-setup-lease-script.avif b/README.d/12-setup-lease-script.avif new file mode 100644 index 0000000..365e0e8 Binary files /dev/null and b/README.d/12-setup-lease-script.avif differ diff --git a/README.d/13-install-custom-script.avif b/README.d/13-install-custom-script.avif new file mode 100644 index 0000000..df9f734 Binary files /dev/null and b/README.d/13-install-custom-script.avif differ diff --git a/README.d/13-remove-script.avif b/README.d/13-remove-script.avif deleted file mode 100644 index a5c7daf..0000000 Binary files a/README.d/13-remove-script.avif and /dev/null differ diff --git a/README.d/14-remove-script.avif b/README.d/14-remove-script.avif new file mode 100644 index 0000000..a5c7daf Binary files /dev/null and b/README.d/14-remove-script.avif differ diff --git a/README.md b/README.md index da0bb5e..8bf4681 100644 --- a/README.md +++ b/README.md @@ -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. -- cgit v1.2.3-54-g00ecf