README: move configuration down, make it a separate paragraph
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 5 KiB After Width: | Height: | Size: 5 KiB |
BIN
README.d/08-apply-configuration.avif
Normal file
After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
56
README.md
|
@ -91,6 +91,23 @@ Now let's download the main scripts and add them in configuration on the fly.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
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; }";
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
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;";
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Editing configuration
|
||||||
|
---------------------
|
||||||
|
|
||||||
The configuration needs to be tweaked for your needs. Edit
|
The configuration needs to be tweaked for your needs. Edit
|
||||||
`global-config-overlay`, copy relevant configuration from
|
`global-config-overlay`, copy relevant configuration from
|
||||||
[`global-config`](global-config) (the one without `-overlay`).
|
[`global-config`](global-config) (the one without `-overlay`).
|
||||||
|
@ -98,27 +115,22 @@ Save changes and exit with `Ctrl-o`.
|
||||||
|
|
||||||
/system/script/edit global-config-overlay source;
|
/system/script/edit global-config-overlay source;
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
To apply your changes run `global-config`, which will automatically load
|
||||||
|
the overlay as well:
|
||||||
|
|
||||||
|
/system/script/run global-config;
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
This last step is required when ever you make changes to your configuration.
|
||||||
|
|
||||||
> ℹ️ **Info**: It is recommended to edit the configuration using the command
|
> ℹ️ **Info**: It is recommended to edit the configuration using the command
|
||||||
> line interface. If using Winbox on Windows OS, the line endings may be
|
> 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:
|
> missing. To fix this run:
|
||||||
> `/system/script/set source=[ $Unix2Dos [ get global-config-overlay source ] ] global-config-overlay;`
|
> `/system/script/set source=[ $Unix2Dos [ get global-config-overlay source ] ] global-config-overlay;`
|
||||||
|
|
||||||
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; }";
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
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;";
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Updating scripts
|
Updating scripts
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
@ -127,7 +139,7 @@ everything is up-to-date it will not produce any output.
|
||||||
|
|
||||||
$ScriptInstallUpdate;
|
$ScriptInstallUpdate;
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
If the update includes news or requires configuration changes a notification
|
If the update includes news or requires configuration changes a notification
|
||||||
is sent - in addition to terminal output and log messages.
|
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;
|
$ScriptInstallUpdate check-certificates,check-routeros-update;
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Scheduler and events
|
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;";
|
/system/scheduler/add name="check-routeros-update" interval=1h on-event="/system/script/run check-routeros-update;";
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Some events can run a script. If you want your DHCP hostnames to be available
|
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
|
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 ];
|
/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;";
|
/system/scheduler/add name="dhcp-to-dns" interval=5m on-event="/system/script/run dhcp-to-dns;";
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
There's much more to explore... Have fun!
|
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/";
|
$ScriptInstallUpdate hello-world.rsc "base-url=https://git.eworm.de/cgit/routeros-scripts-custom/plain/";
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
For a script to be considered valid it has to begin with a *magic token*.
|
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
|
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;
|
/system/script/remove to-be-removed;
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Possibly a scheduler and other configuration has to be removed as well.
|
Possibly a scheduler and other configuration has to be removed as well.
|
||||||
|
|
||||||
|
|