This is an occ command to cleanup orphaned remote storages. To explain why this is necessary, a little background is required. While shares are able to be deleted as a normal matter of course, remote storages with shared:: are not included in this process.

This might not, normally, be a problem. However, if a user has re-shared a remote share which has been deleted it will. This is because when the original share is deleted, the remote re-share reference is not. Internally, the fileid will remain in the file cache and storage for that file will not be deleted.

As a result, any user(s) who the share was re-shared with will now get an error when trying to access that file or folder. That’s why the command is available. So, to cleanup all orphaned remote storages, run it as follows:

sudo -u www-data php occ sharing:cleanup-remote-storages

You can also set it up to run as a background job.

These commands are not available in single-user (maintenance) mode.


  system:cron             Execute background jobs as cron
sudo -u www-data php occ -h system:cron
  system:cron [options]


-p, --progress

Shows a progress bar - for use in manual execution. Do not use when executing from crontab

To execute background jobs using cron, you can use the system:cron command, as in the following example:

sudo -u www-data php occ system:cron

If the --progress or -p argument is specified, then progress output will be displayed in the console, as in the example below.

Executing: 12 - OCA\UpdateNotification\Notification\BackgroundJob
  13 [------------->--------------]

If neither of these arguments is provided, no output will be displayed by the command.

Displaying progress information is useful when you want visual confirmation that background jobs have been executed. However, in a non-interactive environment, such as crontab, it should not be used.

Updating an Existing System Cron Configuration

If you have already automated background jobs via Cron, you must update the relevant crontab entry using the example below as a guide.

# Instead of the following configuration
/usr/bin/php -f /path/to/your/owncloud/cron.php

# Use the following one instead
sudo -u www-data php occ system:cron

This command does not work if: