From c247fe5a9697bd297d0b1f7645a57f7a6550a58e Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 17 Feb 2023 07:57:10 +0100 Subject: [PATCH] README: move configuration down, make it a separate paragraph --- ....avif => 05-run-and-schedule-scripts.avif} | Bin ...le-update.avif => 06-schedule-update.avif} | Bin ...vif => 07-edit-global-config-overlay.avif} | Bin README.d/08-apply-configuration.avif | Bin 0 -> 2437 bytes ...te-scripts.avif => 09-update-scripts.avif} | Bin ...l-scripts.avif => 10-install-scripts.avif} | Bin ...le-script.avif => 11-schedule-script.avif} | Bin ...script.avif => 12-setup-lease-script.avif} | Bin ...ipt.avif => 13-install-custom-script.avif} | Bin ...move-script.avif => 14-remove-script.avif} | Bin README.md | 56 +++++++++++------- 11 files changed, 34 insertions(+), 22 deletions(-) rename README.d/{06-run-and-schedule-scripts.avif => 05-run-and-schedule-scripts.avif} (100%) rename README.d/{07-schedule-update.avif => 06-schedule-update.avif} (100%) rename README.d/{05-edit-global-config-overlay.avif => 07-edit-global-config-overlay.avif} (100%) create mode 100644 README.d/08-apply-configuration.avif rename README.d/{08-update-scripts.avif => 09-update-scripts.avif} (100%) rename README.d/{09-install-scripts.avif => 10-install-scripts.avif} (100%) rename README.d/{10-schedule-script.avif => 11-schedule-script.avif} (100%) rename README.d/{11-setup-lease-script.avif => 12-setup-lease-script.avif} (100%) rename README.d/{12-install-custom-script.avif => 13-install-custom-script.avif} (100%) rename README.d/{13-remove-script.avif => 14-remove-script.avif} (100%) diff --git a/README.d/06-run-and-schedule-scripts.avif b/README.d/05-run-and-schedule-scripts.avif similarity index 100% rename from README.d/06-run-and-schedule-scripts.avif rename to README.d/05-run-and-schedule-scripts.avif diff --git a/README.d/07-schedule-update.avif b/README.d/06-schedule-update.avif similarity index 100% rename from README.d/07-schedule-update.avif rename to 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 similarity index 100% rename from README.d/05-edit-global-config-overlay.avif rename to README.d/07-edit-global-config-overlay.avif diff --git a/README.d/08-apply-configuration.avif b/README.d/08-apply-configuration.avif new file mode 100644 index 0000000000000000000000000000000000000000..b66af1a7ad18f9ee6b4958b1de8c5db463d58382 GIT binary patch literal 2437 zcmbW0d03M97RP_cA}DGoS|GTPmgX{oj9XcQYo^s`re!&W2#L8ME@@@rQaL(PX=+(o zS+;4plw_7#YA%&a<&tS?Zdlhg%fYls=6$K=-sk>tpL_4&Iq&(N-#MJ$`Mf*;0Q7iK zaRPP>p9dg=VC0TA#xQQtKjL-+yT$EXVU zQK9l00(zSAL&7<5<^+HOfKMRDT!oTeD3@o5EdZdsAkE_Q!{nRDD`Y6)!Y%MO*fAD# z$MBGF`2wWBD^S@vmd}G7ZY1-C+^+)wP~`+ha^zRSmj?3%LID)r`2tQj6p8#u0T+sp zAq}7h>Tu-Z27Bkb6W=BG0-ZISg>SkA+5$GL{3Gj?y#Nc=xVX7M7s(d|K-Lc&0TzQ%#GtW?ii$WK zRtZm3!7D4{N$MJEL@HTVhf1bU^bE|G>d{OWQz%B(#-9y@lYM02xxVEIt!!W$yTIA5E+RX1=z(7<#n1~kKY?u1_+aI zN?HpSk;sNimKqr^WBzDmZDVWa=;Z9;y4r2c2JekNzMD4taRRx#9YOry$f)R;U9oYy zlT-E|IGFltTISKL?3`oAb5EQ-S9t!y#Y>lqu3fJX->AG?BBQu5SIc9g+wXBTnL3-FgO8) z)~93CS)PjQ2n`w|5leK)C@8PPEw=P}uNfeGtfXbY95$SS(d1<1B^hgquE!lbox5ptMRFZ!G}%}G*73boH^pk7bGnkV?@pG-b@)k4xKbJ0XWyX{=3)@P4HoBZsp_YX+Ih5fZ#RdLN*Po2un zcBZ^uS*r8yU4kTRYcSc)J$FN7Ea4Up~H(PO6Qg> z?|WuWtWvwy+BlWV5NU2->DWx7-VO|?3O1pil=>Yz_;dZ!J`K11w2f)QUG#xEQh+PP zTL${c_zvnFDO1pwy5gFfVRgfjk#Ui!3qaoSeDu`P8TfViwUtV&u=hi2s>`0W4>VKV z-lP>f6M^S{c7*JiI#9yd7z%BAe{y6MGFs41EuaB!apw8{B|PT*M4U~c>TX_$(z8EO z&zkHd`uHw8y5?R9mZaPx6x`dp>8rIK^NzC3|NjZLp=+>x~V@*hwCA z=VcG5I+^u`ca?cw^0K>Qnx8tbbBKLl;LD8yR!0HnVRY_}%!~wO%}N~eo^;A)b&Jw; zvIF7w!zLd}GiD^~dP{CxuyUcK3uy<~hr?PO`@;M&y!3#wz|S$2=-U&Otb*9Q_nl7( zM#T21DCadyIc>iacJ^&~Q8^^7Y7roWWY1s0F_>m9|g$(=x; z(Vy#dPmqri+xJb<>l5;WE|M!2pHt(F;oCM(3h?|yVMXJKWS*AGyq#5+rS66Y1j)SD z3p>BHhTF=}Y44Z}@M_BL%BpB>u8)@eBdOQG>fJ|gsTwIYU0%L!d@eWs<=QtbQPsYe z?qq0vyzQM?^1899#B9nndt$FgkH|rK(X94lM3Q=b<$z_i>koMyA8GN;#qIeax#Hjk zNymt;y$RR6g1+}RTDtT3ZQV0(XSNC-3C3P)mgZ!|oSYK94p33N^y^UDE^(ypp#7{x z4*M9v{g*8so26kI>UqU)({48oS8hz&(%}>;b-@_harKTIBTz`r^MuD?)A`Ddf4b~w2$=eJh6X~ znzKVqL^MiNcKOyakD5dEddYv5n0TFZ*Ge5+;o;xK>Zl$oToRZ=y?~MJNlBBo1%Y?1 zRVznAO1(aZ5x2`+ds)8hV&hP!qi^rly0Z*j-5zO+kIs=}7HVr5c@+Kf%6vZ8ri!%Q zT#|<+B@Go+=bK-};LE4ZS(~{M&)+xb@-@`6x4V|E&YqTh+5Ks}`=^=0!<(Y`GfuJ5 YsSidUC(c4dfoaqY>zTcCgQ7Ek0U)B8WdHyG literal 0 HcmV?d00001 diff --git a/README.d/08-update-scripts.avif b/README.d/09-update-scripts.avif similarity index 100% rename from README.d/08-update-scripts.avif rename to README.d/09-update-scripts.avif diff --git a/README.d/09-install-scripts.avif b/README.d/10-install-scripts.avif similarity index 100% rename from README.d/09-install-scripts.avif rename to README.d/10-install-scripts.avif diff --git a/README.d/10-schedule-script.avif b/README.d/11-schedule-script.avif similarity index 100% rename from README.d/10-schedule-script.avif rename to README.d/11-schedule-script.avif diff --git a/README.d/11-setup-lease-script.avif b/README.d/12-setup-lease-script.avif similarity index 100% rename from README.d/11-setup-lease-script.avif rename to 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 similarity index 100% rename from README.d/12-install-custom-script.avif rename to README.d/13-install-custom-script.avif diff --git a/README.d/13-remove-script.avif b/README.d/14-remove-script.avif similarity index 100% rename from README.d/13-remove-script.avif rename to README.d/14-remove-script.avif 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,27 +115,22 @@ 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) + +To apply your changes run `global-config`, which will automatically load +the overlay as well: + + /system/script/run global-config; + +![screenshot: apply configuration](README.d/08-apply-configuration.avif) + +This last step is required when ever you make changes to your configuration. > ℹ️ **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: +> missing. To fix this run: > `/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; }"; - -![screenshot: run and schedule scripts](README.d/06-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/07-schedule-update.avif) - 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.