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

**URL:** <https://help.nextcloud.com/t/stop-scans-on-external-storage-or-how-to-disable-delete-a-background-job/65566>\
**Category:** ℹ️ Support\
**Tags:** nc17\
**Created:** [December 4, 2019, 11:36am UTC](https://help.nextcloud.com/t/stop-scans-on-external-storage-or-how-to-disable-delete-a-background-job/65566 "2019-12-04T11:36:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![smeijer](https://help.nextcloud.com/user_avatar/help.nextcloud.com/smeijer/32/18222_2.png) [@smeijer](https://help.nextcloud.com/u/smeijer)\
**Post date:** [December 4, 2019, 11:36am UTC](https://help.nextcloud.com/t/stop-scans-on-external-storage-or-how-to-disable-delete-a-background-job/65566/1 "2019-12-04T11:36:39Z")

</div>

Hi,

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.

```
"OCA\Activity\BackgroundJob\EmailNotification"
"OCA\Activity\BackgroundJob\ExpireActivities"
"OCA\AdminAudit\BackgroundJobs\Rotate"
"OCA\Bookmarks\BackgroundJobs\PreviewsJob"
"OCA\Cospend\Cron\AutoExport"
"OCA\Cospend\Cron\RepeatBills"
"OCA\DAV\BackgroundJob\CleanupDirectLinksJob"
"OCA\DAV\BackgroundJob\CleanupInvitationTokenJob"
"OCA\DAV\BackgroundJob\EventReminderJob"
"OCA\DAV\BackgroundJob\RefreshWebcalJob"
"OCA\DAV\BackgroundJob\UpdateCalendarResourcesRoomsBackgroundJob"
"OCA\Deck\Cron\CardDescriptionActivity"
"OCA\Deck\Cron\DeleteCron"
"OCA\Deck\Cron\ScheduledNotifications"
"OCA\Federation\SyncJob"
"OCA\Files_Antivirus\BackgroundJob\BackgroundScanner"
"OCA\Files\BackgroundJob\CleanupFileLocks"
"OCA\Files\BackgroundJob\DeleteOrphanedItems"
"OCA\Files\BackgroundJob\ScanFiles"
"OCA\Files_Sharing\BackgroundJob\FederatedSharesDiscoverJob"
"OCA\Files_Sharing\DeleteOrphanedSharesJob"
"OCA\Files_Sharing\ExpireSharesJob"
"OCA\Files_Trashbin\BackgroundJob\ExpireTrash"
"OCA\Files_Versions\BackgroundJob\ExpireVersions"
"OCA\FullTextSearch\Cron\Index"
"OCA\GroupFolders\BackgroundJob\ExpireGroupVersions"
"OCA\NextcloudAnnouncements\Cron\Crawler"
"OCA\PhoneTrack\Cron\AutoExport"
"OCA\QuotaWarning\Job\User"
"OCA\RansomwareDetection\BackgroundJob\CleanUpJob"
"OCA\Richdocuments\Backgroundjobs\ObtainCapabilities"
"OCA\Spreed\BackgroundJob\ExpireSignalingMessage"
"OCA\Spreed\BackgroundJob\RemoveEmptyRooms"
"OCA\Support\BackgroundJobs\CheckSubscription"
"OCA\SuspiciousLogin\BackgroundJob\ETLJob"
"OCA\SuspiciousLogin\BackgroundJob\TrainJobIpV4"
"OCA\SuspiciousLogin\BackgroundJob\TrainJobIpV6"
"OCA\Text\Cron\Cleanup"
"OCA\TwoFactorBackupCodes\BackgroundJob\RememberBackupCodesJob"
"OCA\UpdateNotification\Notification\BackgroundJob"
"OCA\UpdateNotification\ResetTokenBackgroundJob"
"OC\Authentication\Token\DefaultTokenCleanupJob"
"OC\BackgroundJob\Legacy\RegularJob"
"OC\Core\BackgroundJobs\CleanupLoginFlowV2"
"OC\Log\Rotate"
"OC\Preview\BackgroundCleanupJob"

```

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!

Cheers.

---

<div class="post-metadata">

**Author:** ![anmolnar](https://help.nextcloud.com/letter_avatar/anmolnar/32/6_22734026db12803ebb3e059622ac3534.png) [@anmolnar](https://help.nextcloud.com/u/anmolnar)\
**Post date:** [December 16, 2019, 9:38am UTC](https://help.nextcloud.com/t/stop-scans-on-external-storage-or-how-to-disable-delete-a-background-job/65566/2 "2019-12-16T09:38:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![h3rb3rt](https://help.nextcloud.com/user_avatar/help.nextcloud.com/h3rb3rt/32/9824_2.png) [@h3rb3rt](https://help.nextcloud.com/u/h3rb3rt)\
**Post date:** [October 20, 2020, 8:57am UTC](https://help.nextcloud.com/t/stop-scans-on-external-storage-or-how-to-disable-delete-a-background-job/65566/3 "2020-10-20T08:57:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![christianpoortvliet](https://help.nextcloud.com/letter_avatar/christianpoortvliet/32/6_22734026db12803ebb3e059622ac3534.png) [@christianpoortvliet](https://help.nextcloud.com/u/christianpoortvliet)\
**Post date:** [December 30, 2020, 10:48am UTC](https://help.nextcloud.com/t/stop-scans-on-external-storage-or-how-to-disable-delete-a-background-job/65566/4 "2020-12-30T10:48:48Z")

</div>

same here:  
SHOW ENGINE INNODB STATUS;

```
	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
--------
```

---

<div class="post-metadata">

**Author:** ![christianpoortvliet](https://help.nextcloud.com/letter_avatar/christianpoortvliet/32/6_22734026db12803ebb3e059622ac3534.png) [@christianpoortvliet](https://help.nextcloud.com/u/christianpoortvliet)\
**Post date:** [December 30, 2020, 11:02am UTC](https://help.nextcloud.com/t/stop-scans-on-external-storage-or-how-to-disable-delete-a-background-job/65566/5 "2020-12-30T11:02:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![h3rb3rt](https://help.nextcloud.com/user_avatar/help.nextcloud.com/h3rb3rt/32/9824_2.png) [@h3rb3rt](https://help.nextcloud.com/u/h3rb3rt)\
**Post date:** [January 14, 2021, 7:03am UTC](https://help.nextcloud.com/t/stop-scans-on-external-storage-or-how-to-disable-delete-a-background-job/65566/6 "2021-01-14T07:03:15Z")

</div>

not a good idea, I am sure

> [@Cron.php takes too long and can end up running multiple times](https://help.nextcloud.com/t/cron-php-takes-too-long-and-can-end-up-running-multiple-times/85024/12):
>
> @christianpoortvliet I am not sure deleting the whole oc\_jobs content is a good solution. Especially because the jobs table is used to run recurring jobs which are not directly handled by the linux cron daemon. For now, as far as I understand the bug ticket, the preview-generator app could have something to do with all of it.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 4, 2024, 12:22pm UTC](https://help.nextcloud.com/t/stop-scans-on-external-storage-or-how-to-disable-delete-a-background-job/65566/7 "2024-12-04T12:22:36Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 11, 2024, 4:05pm UTC](https://help.nextcloud.com/t/stop-scans-on-external-storage-or-how-to-disable-delete-a-background-job/65566/8 "2024-12-11T16:05:36Z")

</div>


