brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: maintenance_window_start moves Nextcloud's heavy background jobs to the night

Nextcloud
~/tips/tip-nextcloud-maintenance-window-start

docker exec -it --user www-data nextcloud php occ config:system:set maintenance_window_start --type=integer --value=1

Makes Nextcloud run its heavy daily background jobs during a night window you choose.

The admin overview warning about a missing maintenance window start time is another one of those Nextcloud messages that looks scarier than it is. It’s one setting, and on a home server like my Unraid box it’s a setting I’d want anyway: the heavy background jobs run while I’m asleep.

Some background jobs only run once a day and don’t care when, such as activity expiration, suspicious login training and update checks. With maintenance_window_start set to an hour, Nextcloud holds those back during the day and only runs them in the four hours after that hour. Set it with occ:

docker exec -it --user www-data nextcloud php occ config:system:set maintenance_window_start --type=integer --value=1

That writes 'maintenance_window_start' => 1, into config.php, and those jobs then run between 01:00 and 05:00. You can also add that line to config.php by hand; on Unraid it sits in the appdata folder of the container, for example /mnt/user/appdata/nextcloud/config/config.php, depending on your template.

Two catches. The hour is in UTC, not local time. From Leiden, a value of 1 means 02:00 in winter and 03:00 in summer, which still lands in the night, but pick your number with that in mind. And the setting only counts in cron mode, so if your background jobs are still on AJAX, switch them to cron first. If you really don’t care when these jobs run, the docs say you can set the value to 100, but then the heavy ones may run while people are using the server. I’d keep a night hour that doesn’t clash with your backups or parity check.

Further reading: Nextcloud admin manual: background jobs

Going deeper: Guide: find out why a Linux service failed, with journalctl

More Nextcloud tips sudo -E -u www-data php occ user:report sudo -E -u www-data php occ app:update --showonly sudo -E -u www-data php occ background-job:history -s 3 -l 10 docker exec --user www-data nextcloud php occ maintenance:mode --on docker exec -it --user www-data nextcloud php occ user:resetpassword layla All Nextcloud tips (13) All topics

Link