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

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.

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

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