Frequently Asked Question
occ occ maintenance (maintenance operations)
Last Updated 3 hours ago
occ occ maintenance (maintenance operations)
Maintenance Mode Commands
The following OCC commands control maintenance mode and related tasks. Use them from the command line as the web‑server user (usually www-data).
Enable maintenance mode
sudo -u www-data php /path/to/nextcloud/occ maintenance:mode --on
- All HTTP requests are blocked except for health‑check URLs.
- Use before upgrades, migrations or other disruptive operations.
Disable maintenance mode
sudo -u www-data php /path/to/nextcloud/occ maintenance:mode --off
- Restores normal operation once the maintenance task is complete.
Run repair steps
sudo -u www-data php /path/to/nextcloud/occ maintenance:repair
- Repairs database inconsistencies, file locks and other integrity issues.
- Run after encountering errors during an upgrade or after manual file changes.
Update the .htaccess file
sudo -u www-data php /path/to/nextcloud/occ maintenance:update:htaccess
- Generates a fresh
.htaccesswith the latest security rules. - Helpful after changing server configuration or when adding new rewrite rules.
Run the upgrade process
sudo -u www-data php /path/to/nextcloud/occ upgrade
- Executes the core upgrade routine after you have pulled the latest code.
- Ensure maintenance mode is enabled first, then run this command.
