Maintenance Commands

Use these commands when you upgrade ownCloud, manage encryption, perform backups and other tasks that require locking users out until you are finished.

maintenance
 maintenance:data-fingerprint        Update the systems data-fingerprint after a backup is restored
 maintenance:mimetype:update-db      Update database mimetypes and update filecache
 maintenance:mimetype:update-js      Update mimetypelist.js
 maintenance:mode                    Set maintenance mode
 maintenance:repair                  Repair this installation
 maintenance:singleuser              Set single user mode
 maintenance:update:htaccess         Updates the .htaccess file

maintenance:mode locks the sessions of all logged-in users, including administrators, and displays a status screen warning that the server is in maintenance mode. Users who are not already logged in cannot log in until maintenance mode is turned off. When you take the server out of maintenance mode logged-in users must refresh their Web browsers to continue working.

sudo -u www-data php occ maintenance:mode --on
sudo -u www-data php occ maintenance:mode --off

Putting your ownCloud server into single-user mode allows admins to log in and work, but not ordinary users. This is useful for performing maintenance and troubleshooting on a running server.

sudo -u www-data php occ maintenance:singleuser --on
Single user mode enabled

Turn it off when you’re finished:

sudo -u www-data php occ maintenance:singleuser --off
Single user mode disabled

Run maintenance:data-fingerprint to tell desktop and mobile clients that a server backup has been restored. This command changes the ETag for all files in the communication with sync clients, informing them that one or more files were modified. After the command completes, users will be prompted to resolve any conflicts between newer and older file versions.

Installation Repair Commands

The maintenance:repair command helps administrators repair an installation. The command runs automatically during upgrades to clean up the database. So, while you can run it manually, there usually isn’t a need to.

Your ownCloud installation needs to be in maintenance mode to use the maintenance:repair command.

Repair Command Options

The maintenance:repair command supports the following options:

Option Description

--ansi

Force ANSI output.

--include-expensive

Use this option when you want to include resource and load expensive tasks.

--list

Lists all possible repair steps

--no-ansi

Disable ANSI output.

-n --no-interaction

Do not ask any interactive question.

--no-warnings

Skip global warnings, show command output only.

-q --quiet

Do not output any message.

-s --single=SINGLE

Run just one repair step given its class name.

-V --version

Display this application version.

-v|vv|vvv --verbose

Increase the verbosity of messages:

  • 1 for normal output

  • 2 for more verbose output and 3 for debug

Here is an example of running the command:

sudo -u www-data php occ maintenance:repair

To list all off the possible repair steps, use the --list option. It should output the following list to the console:

Found 16 repair steps

OC\Repair\RepairMimeTypes -> Repair mime types
OC\Repair\RepairMismatchFileCachePath -> Detect file cache entries with path that does not match parent-child relationships
OC\Repair\FillETags -> Generate ETags for file where no ETag is present.
OC\Repair\CleanTags -> Clean tags and favorites
OC\Repair\DropOldTables -> Drop old database tables
OC\Repair\DropOldJobs -> Drop old background jobs
OC\Repair\RemoveGetETagEntries -> Remove getetag entries in properties table
OC\Repair\RepairInvalidShares -> Repair invalid shares
OC\Repair\RepairSubShares -> Repair sub shares
OC\Repair\SharePropagation -> Remove old share propagation app entries
OC\Repair\MoveAvatarOutsideHome -> Move user avatars outside the homes to the new location
OC\Repair\RemoveRootShares -> Remove shares of a users root folder
OC\Repair\RepairUnmergedShares -> Repair unmerged shares
OC\Repair\DisableExtraThemes -> Disable extra themes
OC\Repair\OldGroupMembershipShares -> Remove shares of old group memberships
OCA\DAV\Repair\RemoveInvalidShares -> Remove invalid calendar and addressbook shares

Running a Single Repair Step

To run a single repair step, use either the -s or --single options, as in the following example.

sudo -u www-data php occ maintenance:repair --single="OCA\DAV\Repair\RemoveInvalidShares"
The step’s name must be quoted, otherwise you will see the following warning message appear, and the command will fail: "Repair step not found. Use --list to show available steps."