recognize icon indicating copy to clipboard operation
recognize copied to clipboard

Have custom cron job intervals

Open teclab-at opened this issue 2 years ago • 11 comments

Describe the feature you'd like to request

The cron job interval of 5 minutes keeps the system from going to deep sleep. Even if there are no new files a whole scan is performed.

I would like to configure my own scan intervals.

Describe the solution you'd like

Either via the administrative settings configure a custom interval, or disable the background job and configure my own cron in /etc/cron.hourly for example.

Describe alternatives you've considered

Similar as it is done with the face recognition app.

teclab-at avatar Jan 16 '23 08:01 teclab-at

This feature already exists. You have to go to "Administration settings / Basic Settings" and change "Webcron" to "Cron (Recomended)". Depending on what operating system you have, you can set it to 10 minutes (for Ubuntu) in the /etc/crontab file like this:

3-59/10 * * * * www-data php -f /var/www/nextcloud/cron.php

this wil invoke a job at h:03, h:13, h:23, h:33, h:43, h:53, h+1:03 and so forth

(You may have to adapt the path to cron.php to your circumstances) A longer intervall as 10 minutes is not recommended. A cloud server is not designed to go into "deep sleep" 😉

I hope I could help 🙏

ernolf avatar Jan 16 '23 10:01 ernolf

This feature already exists. You have to go to "Administration settings / Basic Settings" and change "Webcron" to "Cron (Recomended)".

This solution sets the cron interval for all background tasks and is the opposite what i suggested: having the possibility to configure an individual cycle.

A longer intervall as 10 minutes is not recommended. A cloud server is not designed to go into "deep sleep" 😉

Not agree: For a private family server deep sleep is wanted - we are all living in the same time region ;)

teclab-at avatar Jan 16 '23 14:01 teclab-at

But if that's not what you meant, and the number of files to classify isn't too high, you can do the following:

Make your settings (image- music tagging, etc.) as usual, but set the number of files to be processed per job run to "0". No jobs will be scheduled to the cron-queue this way.

Now you can create a cron job (in /etc/crontab) that will trigger a full classification run, e.g. once a day (here every night at 11:12 p.m.) like this:

12 23 * * * www-data php -f /var/www/nextcloud/occ recognize:classify --quiet

The cron-job will be executed anyway, with or without the jobs scheduled by recognize. but this way, you don't load everything on top of the cron-jobs.

ernolf avatar Jan 16 '23 14:01 ernolf

@ernolf It would be recognize:classify not recrawl as recrawl does trigger background jobs. :)

marcelklehr avatar Jan 16 '23 14:01 marcelklehr

Thats interesting, because I was disabling background jobs completely and did run recrawl and classify - but it did nothing. I'll try setting the file value to zero ...

Thx!

teclab-at avatar Jan 16 '23 14:01 teclab-at

@teclab-at Note that you can set a time window in nextcloud for heavy background jobs to run e.g. during the night, which will also affect recognize. See https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html

marcelklehr avatar Jan 16 '23 14:01 marcelklehr

@teclab-at Note that you can set a time window in nextcloud for heavy background jobs to run e.g. during the night, which will also affect recognize. See https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html

Thank you very much for this tip - did not know that.

teclab-at avatar Jan 16 '23 15:01 teclab-at

@ernolf It would be recognize:classify not recrawl as recrawl does trigger background jobs. :)

You are right, my fault!

ernolf avatar Jan 16 '23 15:01 ernolf

@teclab-at Which version of recognize do you have installed btw?

marcelklehr avatar Jan 16 '23 18:01 marcelklehr

Nextcloud 25.0.2 Recognize 3.3.6

teclab-at avatar Jan 16 '23 19:01 teclab-at

recognize:classify is not the solution as it rescans all files from scratch.

teclab-at avatar Jan 17 '23 11:01 teclab-at