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
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

unique_append()
{
grep -qF "$1" "$2" || echo "$1" >> "$2"
}

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

/etc/crontabs/root

1 change: 1 addition & 0 deletions packages/lime-docs/files/www/docs/lime-example.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ config lime system
option root_password_policy 'DO_NOTHING' # When configured to SET_SECRET, the root password secret will be configured as specified in root_password_secret. When set to RANDOM a strong random password will be set if root has no password, use this if your firmware is built with the ssh keys inside. DO_NOTHING does nothing, leaving the root password empty (you will have to set it manually or through FirstBootWizard).
option root_password_secret '' # This is the password hash as stored in /etc/shadow, it is only used when root_password_policy=SET_SECRET. You can generate the secret with 'openssl passwd -1' to be compatible with most openwrt firmwares, use a strong password with at least 10 numbers and letters, the longer the better!. For improved security use "openssl passwd -6" for SHA512 (or -5 for SHA256) but be aware that not all firmwares support this.
option deferable_reboot_uptime_s '97200'
option deferable_reboot_ping_target '4.2.2.2' # b.resolvers.Level3.net # the reboot scheduled by deferable_reboot, if installed, will be deferred if the ping to this IP is succesful
option firstbootwizard_configured false
option firstbootwizard_dismissed false # When true fbw banner will be hidden.

Expand Down
1 change: 1 addition & 0 deletions packages/lime-system/files/etc/config/lime-defaults
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ config lime system
option root_password_policy 'DO_NOTHING'
option root_password_secret ''
option deferable_reboot_uptime_s '97200'
option deferable_reboot_ping_target '4.2.2.2'
option firstbootwizard_configured false
option firstbootwizard_dismissed false

Expand Down