Oc_jobs cleanup how to?

Nextcloud version (eg, 20.0.5): 21.0.4
Operating system and version (eg, Ubuntu 20.04): 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.51
PHP version (eg, 7.4): 7.4.24

The issue you are facing:

After removal some Applications are not removing they jobs from the oc_jobs, so they stacking there forever. Example is Files Antivirus that was removed long time ago, but still in a DB, the same is for Federation Features.
Or Authentication is twice as OC\Authentication\Token\DefaultTokenCleanupJob and \OC\Authentication\Token\DefaultTokenCleanupJob, both are executed frequently.

In opposite there is not job OCA\Maps\Service registered as listed in this ticket

Question is it safe to remove those jobs? For Antivirus, Federation?
Can job be add?

jobs 	class
3 	OCA\Files_Retention\BackgroundJob\RetentionJob
2 	OCA\Talk\BackgroundJob\ExpireSignalingMessage
2 	OCA\Talk\BackgroundJob\RemoveEmptyRooms
1 	OCA\Files\BackgroundJob\CleanupDirectEditingTokens
1 	OCA\UserStatus\BackgroundJob\ClearOldStatusesBackgroundJob
1 	OCA\Files\BackgroundJob\CleanupFileLocks
1 	OCA\WorkflowEngine\BackgroundJobs\Rotate
1 	OCA\Files\BackgroundJob\DeleteOrphanedItems
1 	OC\Authentication\Token\DefaultTokenCleanupJob
1 	OCA\Files\BackgroundJob\ScanFiles
1 	OC\Core\BackgroundJobs\CleanupLoginFlowV2
1 	OCA\Files_Antivirus\BackgroundJob\BackgroundScanner
1 	OC\Log\Rotate
1 	OCA\Files_External\BackgroundJob\CredentialsCleanup
1 	OC\Preview\BackgroundCleanupJob
1 	OC\Security\Bruteforce\CleanupJob
1 	OCA\Files_Sharing\BackgroundJob\FederatedSharesDiscoverJob
1 	\OC\Authentication\Token\DefaultTokenCleanupJob
1 	OCA\Files_Sharing\DeleteOrphanedSharesJob
1 	OCA\Files_Sharing\ExpireSharesJob
1 	OCA\Files_Trashbin\BackgroundJob\ExpireTrash
1 	OCA\Files_Versions\BackgroundJob\ExpireVersions
1 	OCA\Files_external_dropbox\BackgroundJob\MetaData
1 	OCA\Activity\BackgroundJob\DigestMail
1 	OCA\Mail\BackgroundJob\CleanupJob
1 	OCA\Activity\BackgroundJob\EmailNotification
1 	OCA\NextcloudAnnouncements\Cron\Crawler
1 	OCA\Activity\BackgroundJob\ExpireActivities
1 	OCA\PhoneTrack\Cron\AutoExport
1 	OCA\AdminAudit\BackgroundJobs\Rotate
1 	OCA\Polls\Cron\JanitorCron
1 	OCA\ContactsInteraction\BackgroundJob\CleanupJob
1 	OCA\Polls\Cron\NotificationCron
1 	OCA\Contacts\Cron\SocialUpdateRegistration
1 	OCA\Recognize\BackgroundJobs\ClassifyJob
1 	OCA\Cospend\Cron\AutoExport
1 	OCA\ServerInfo\Jobs\UpdateStorageStats
1 	OCA\Cospend\Cron\RepeatBills
1 	OCA\Support\BackgroundJobs\CheckSubscription
1 	OCA\DAV\BackgroundJob\CleanupDirectLinksJob
1 	OCA\Survey_Client\BackgroundJobs\MonthlyReport
1 	OCA\DAV\BackgroundJob\CleanupInvitationTokenJob
1 	OCA\Talk\BackgroundJob\CheckHostedSignalingServer
1 	OCA\DAV\BackgroundJob\EventReminderJob
1 	OCA\Talk\BackgroundJob\CheckMatterbridges
1 	OCA\DAV\BackgroundJob\RefreshWebcalJob
1 	OCA\DAV\BackgroundJob\UpdateCalendarResourcesRoomsBackgroundJob
1 	OCA\DAV\BackgroundJob\UploadCleanup
1 	OCA\Talk\BackgroundJob\ResetAssignedSignalingServer
1 	OCA\DAV\CardDAV\SyncJob
1 	OCA\Talk\BackgroundJob\ResetInCallFlags
1 	OCA\Deck\Cron\CardDescriptionActivity
1 	OCA\Text\Cron\Cleanup
1 	OCA\Deck\Cron\DeleteCron
1 	OCA\TwoFactorBackupCodes\BackgroundJob\RememberBackupCodesJob
1 	OCA\Deck\Cron\ScheduledNotifications
1 	OCA\UpdateNotification\Notification\BackgroundJob
1 	OCA\Federation\SyncJob
1 	OCA\UpdateNotification\ResetTokenBackgroundJob

Is this the first time you’ve seen this error? Yes

Steps to replicate it:

  1. Add some apps so that they will create cron jobs
  2. Delete those apps
  3. check oc_jobs that jobs were not removed

File a bug report for the Antivirus app! They created the job and they should be able if you can remove it.

You can try to remove it, a better way would be perhaps a cleanup routine that can detect if some background jobs refers to non-used apps. I didn’t go through the main server repository if there are topics about that.

For missing cronjobs, I’d try to disable and enable an app. If that doesn’t help, it’s the bug tracker of that app again.

1 Like