Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically postpone automated reboots by deferable-reboot #1147

Merged
merged 7 commits into from
Dec 31, 2024

Conversation

ilario
Copy link
Member

@ilario ilario commented Nov 25, 2024

As explained in #1023, deferable-reboot was developed in two pieces, the main one on this repository and a very useful piece in the LibreRouterOS repository.

Without the second piece, the routers would just reboot every 27 hours, annoying.
With the second piece, the routers are checking the internet connectivity every 3 minutes (by means of a ping to a known IP on the internet) and the reboot is deferred by 13 minutes if the ping is successful.

With this PR, the second piece is also included in the deferable-reboot package in this repository.

The IP to be pinged has been de-hardcoded and moved to the LibreMesh configuration files in the system section.

The chosen IP is one of the ones being used as DNS:

list resolvers 4.2.2.2 # b.resolvers.Level3.net # DNS servers node will use
list resolvers 141.1.1.1 # cns1.cw.net # Set every entry empty for using the upstream (ISP) DNS server

I am testing in these days, please do not merge yet.

@ilario
Copy link
Member Author

ilario commented Nov 30, 2024

Tested and it works.
@germanferrero once this gets merged, you should consider removing the file in the LibreRouterOS repository https://gitlab.com/librerouter/librerouteros/-/blob/librerouter-1.5/files/etc/uci-defaults/90-cron-defer-reboot

@ilario
Copy link
Member Author

ilario commented Dec 2, 2024

Just increased a bit the deferring time (from 13 min to 30 min) in order to be sure that the network had time to re-establish the connection after a failure.
Also, added a random delay in the execution of the ping for not bombarding too hard the 4.2.2.2 with pings (does it ban IPs pinging too much?).

Copy link
Member

@G10h4ck G10h4ck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see inline comments

}

unique_append \
"*/3 * * * * ((sleep $((RANDOM % 120)); if ping -c 10 -W 10 \$(uci -q get lime-autogen.system.deferable_reboot_ping_target) &> /dev/null; then awk '{print \$1 + 1800}' /proc/uptime > /tmp/deferable-reboot.defer ; fi )&) "\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a bit ugly and breakage prone to add a command so complex in the crontab, do you mind to create a script that does that, and call it from the crontab ? Ultimately I could even merge it like this but I do prefer if a more elegant solution is proposed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for the suggestion. Check it out now

@ilario
Copy link
Member Author

ilario commented Dec 31, 2024

I took advantage for renaming the package fixing a typo in the name of the package itself.
I think that we should fix this before including this package in a LibreMesh release.

Also, I think that this package should not be in LibreMesh repositories. Instead it should be in OpenWrt ones, and I think that the typo should be fixed before pushing it to OpenWrt (unless it was intentional?).

@G10h4ck G10h4ck merged commit 7345673 into libremesh:master Dec 31, 2024
1 check passed
@ilario
Copy link
Member Author

ilario commented Jan 1, 2025

Picked in branch 2024.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants