Automatically upgrade OS during early morning?

TOS 5 was applied to my Omnia around 09:45 (Central Daylight Time US (UTC-5)) on Thursday, 04-June, which was a bit disruptive. Is there a way to ensure that this only occurs during off-peak hours?

I have these settings:

Screen Shot 2020-06-08 at 11.20.58 AM

1 Like

I was thinking about something similar. I really do not like updates to come during a day when I need a stable connection for work.

Currently, I am testing this setup:

  1. Disable automatic updates in foris

  2. Have a cronjob to run at 3:00am

    In LuCI > System > Scheduled Tasks, I added the following line:

    0 3 * * *     /usr/bin/pkgupdate --batch
    

    Note: Don’t forget to restart the cron service, if the file was empty (as the page tells you):

     $ /etc/init.d/cron restart 
    

May be pkgupdate needs more flags, IDK. Would like to hear from the developers…

I just have mine set at “update approval needed” - there’s been too many instances of updates in the past which have required workarounds that I prefer to choose my battles rather than have to wage war when the router decides it wants to! :slight_smile:

2 Likes

Do you get a notification in Foris that an upgrade/patch is available? Does this have any affect on package (e.g. minidlna) updates?

Yep - I get an email and as a result I take a look at the forum and see if there are any issues before I hit the go button.

1 Like

That’s a nice solution.

Does the automatic update system poll to determine if an upgrade is available?

Do you have a screenshot of the UI when a package is available for upgrade?

If you had asked a few hours ago, yes! but I just updated so unable to grab a view for you, sorry.

It appears under the Notifications in Forris

I am thinking about implementation based on some update time window but at the moment that has to be done with custom cron job that runs (preferably) updater supervisor.

Other option are of course here already mentioned approvals and that settings allows you to install updates at time of your choosing or just delay update if you choose (probably preferred). Cron still runs updater every four hours but updates are installed only if approved or if they are pending for given time. Notification about new updates is send by notification system (to mail if configured and to Foris).

Would you recommend to change that crontab line I posted to run updater-supervisor instead? Any flags to pass into it?

The reason I went with pkgupdate --batch was that when I executed updater-supervisor it said Updater autorun disabled. and it did not seem anything happened, but with pkgupdate I actually saw some work being done.

It looks something like this, the Green Update from box will usualy say Update Available…

I would use updater supervisor preferably as it is exactly intended for this purpose. The problem is that it checks on start if updater autorun is enabled or not. I can add option to force to skip this check (to force execution). At the moment doing following uci set updater.autorun.enable=1 && updater-supervisor -d && uci rollback updater should have the same effect.

2 Likes

Is this the correct interpretation?

# enable autorun in /etc/config/updater
uci set updater.autorun.enable=1 

# run updater as daemon
updater-supervisor -d

# restore configuration file's state
uci rollback

After the updater finishes, will its daemon process end?

Did you mean usi revert? I don’t see a rollback option.

Yeh I meant uci revert.

How it works is that updater-supervisor fist checks if it should even run (it checks uci for that) and then daemonize itself. After that we can revert changes. Updater-supervisor runs in the background and starts pkgupdate as child process and tracks its execution catching crashes and reporting changes.

Yeah, that would be a good thing to have for these scheduled updates.

While you are looking at the code, there is one minor thing to check. If autoupdates are off and you run updater-supervisor --help you won’t get any help. The check you mentioned kicks in early. Just a small thing I noticed when I was hunting around.

I don’t mind using the terminal to make these changes, but there should probably be similar configuration in Foris for the less-technically-inclined.

There’s already the field for automatic reboot time and delay is in whole days, so perhaps that time could be simply re-used without introducing another option? (with some random jitter to avoid all central Europe updating in the same minute)

I think the process that grabs the package from your server should be randomized so your server isn’t overwhelmed.

When the package is applied, however, should be configurable (similar to how rebooting is specified now).

Rebooting, if necessary, should happen immediately after the package installation occurs.

1 Like