Managing Background Jobs

Use the background:queue command to manage background jobs.

background:queue
 background:queue:delete     Delete a job from the queue
 background:queue:execute    Run a single background job from the queue
 background:queue:status     List queue status

Deleting a Background Job

The command background:queue:delete deletes a queued background job. It requires the job id of the job to be deleted.

background:queue:delete <Job ID>

Arguments

Job ID

ID of the job to be deleted

Deleting a job cannot be undone. Be sure that you want to delete the job before doing so.

This example deletes queued background job #12.

sudo -u www-data php occ background:queue:delete 12

Job has been deleted.

Executing a Background Job

The command background:queue:execute executes a queued background job. It requires the job id of the job to be executed.

background:queue:execute [options] [--] <Job ID>

Arguments

Job ID

ID of the job to be deleted

Options

-f
--force

Force run the job even if within timing interval

--accept-warning

No warning about the usage of this command will be displayed

This example executes queued background job #12.

sudo -u www-data php occ background:queue:execute 12

This command is for maintenance and support purposes.
This will run the specified background job now. Regular scheduled runs of the job will
continue to happen at their scheduled times.
If you still want to use this command please confirm the usage by entering: yes
yes
Found job: OCA\UpdateNotification\Notification\BackgroundJob with ID 12
Running job...
Finished in 0 seconds

List Queued Backgroundjobs

The command background:queue:status will list queued background jobs, including details when it last ran.

background:queue:status

This example lists the queue status:

sudo -u www-data php occ background:queue:status

+----+---------------------------------------------------+---------------------------+---------------+
| Id | Job                                               | Last run                  | Job Arguments |
+----+---------------------------------------------------+---------------------------+---------------+
| 1  | OCA\Files\BackgroundJob\ScanFiles                 | 2018-06-13T15:15:04+00:00 |               |
| 2  | OCA\Files\BackgroundJob\DeleteOrphanedItems       | 2018-06-13T15:15:04+00:00 |               |
| 3  | OCA\Files\BackgroundJob\CleanupFileLocks          | 2018-06-13T15:15:04+00:00 |               |
| 4  | OCA\DAV\CardDAV\SyncJob                           | 2018-06-12T19:15:02+00:00 |               |
| 5  | OCA\Federation\SyncJob                            | 2018-06-12T19:15:02+00:00 |               |
| 6  | OCA\Files_Sharing\DeleteOrphanedSharesJob         | 2018-06-13T15:15:04+00:00 |               |
| 7  | OCA\Files_Sharing\ExpireSharesJob                 | 2018-06-12T19:15:02+00:00 |               |
| 8  | OCA\Files_Trashbin\BackgroundJob\ExpireTrash      | 2018-06-13T15:15:04+00:00 |               |
| 9  | OCA\Files_Versions\BackgroundJob\ExpireVersions   | 2018-06-13T15:15:04+00:00 |               |
| 10 | OCA\UpdateNotification\Notification\BackgroundJob | 2018-06-12T19:15:03+00:00 |               |
| 11 | OC\Authentication\Token\DefaultTokenCleanupJob    | 2018-06-13T15:15:04+00:00 |               |
+----+---------------------------------------------------+---------------------------+---------------+