Stop scans on external storage, or: how to disable / delete a background job


I have connected several shares via external storage (via SMB). I just want to be able to browse these shares from Nextcloud. Nextcloud itself does not really need to be aware of the files residing in these shares (they contain a very large number of small files from snapshots etc).

Every once in a while I notice, that for these shares a scan is done, which is taking hours and hours. The performance of my Nextcloud instance suffers from it. I guess these scans are coming from a scheduled job. I checked for the jobs currently scheduled and targeted “OCA\Files\BackgroundJob\ScanFiles” as the most likely candidate triggering the scan.


I searched the forum and found several posts regarding performance of these scan jobs. However, none of them answered the question that I have, which is: how can I stop these scans from starting in the first place.

Can I just DELETE the entry from oc_jobs? Would there be any other consequence from deleting this job (or will really only these scans on the external shares be disabled)? What would I need to do when I do want these scans to be scheduled again? Can I just INSERT the entry back in?

Thanks a lot for your advice!


I’m interested in this one too. I use Amazon S3 as external storage and scanning the files every time the cron job is running generates AWS cost with no particular reason. I think it would be desirable to disable files scanning on external storages rather than deleting the job entirely.

I jump onto this too.
I have disabled my External Storages completely but for whatever reason this job is still running and scans whatever.
It takes forever and eats up resources for nothing. I do not get the idea of this job if every file action is handled via nextcloud interfaces/apis anyhow.

I am running on NC19 right now

same here:

	mysql tables in use 1, locked 1
10778 lock struct(s), heap size 975056, 1 row lock(s), undo log entries 1
MySQL thread id 2, OS thread handle 140563961583360, query id 115 localhost oc_ncadmin updating
DELETE FROM `oc_jobs` WHERE (`class` = 'OCA\\LookupServerConnector\\BackgroundJobs\\RetryJob') AND (`argument` = '{\"dataArray\":{\"message\":{\"data\":{\"federationId\":\"339AE28C-4A94-4E49-8DDF-0AE9C6474F3D@<output committed)\"},\"type\":\"lookupserver\",\"signer\":\"339AE28C-4A94-4E49-8DDF-0AE9C6474F3D@<output committed"\",\"timestamp\":1546526410},\"signature\":\"gCSJz1n9lrhtStoNWsqJYK5Ajw4ppw1gP3fEc3+LXK8VA49ZD8S3q2hbZY9DXoQICFK9WNLp3xPeZH1SIVfDlnvhrEuoVntPBI0RpeHqXvAfLGIUIvQ5uaeAqWCI0QEKDGwAoP3gr1rdY33gduq6gOpwpqFW0JiomyJqh9FbO6KZu\\/GybqjkSXyY5Io7cJjV09gPwdyclcHq+zM0QimxAUyd7OX\\/ArqUCZQB5K

mysql> DELETE FROM oc_jobs;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect…
Connection id: 2
Current database: ncdb

Query OK, 257192 rows affected (24.69 sec)

sorted, now cron takes 2 seconds.

not a good idea, I am sure