Is my crontab correct? Is files:scan required for external files?

I was hoping someone could review my crontab configuration and make any suggestions. I’m not sure if some of these operations are already being invoked in cron.php.

*/15 * * * * php -f /var/www/html/nextcloud/cron.php
*/30 * * * * php /var/www/html/nextcloud/occ preview:pre-generate
0 5 * * * php /var/www/html/nextcloud/occ preview:generate-all --path=“ryan/files/Pictures”
0 4 * * * php /var/www/html/nextcloud/occ files:scan --path=“ryan/files”

A majority of my files are on external storage, via SMB. I typically add pictures to ryan/files/Pictures, for example, and want the system to generate thumbnails as well as process files that were moved around, etc.

  • preview:pre-generate is ran every 15 minutes, I believe this is fine.
  • preview:generate-all is sort of a catch-all that is ran at 5am (after files are scanned at 4am)
  • files:scan is ran at 4am because, as far as I know, this is the only way to scan external files.
  1. Does this setup look fine? Any suggestions?
  2. Is files:scan absolutely required for external file scans?
  3. What tasks are actually invoked when cron.php is ran?

Thanks.

Hi,

Did you use the Nextcloud “External Storage” app? If so, there is no need to run the file scan and you can comment out or remove that crontab entry.

For external storage you can enable previews in the configuration area. When you click the 3 dots, you see the checkbox there. If this is checked, then it should actually not be necessary to have the cron job for that storage set up.
However I just saw this issue:

The last post could mean, that there is no way to disable preview generation on ext. storages - which would match the topic. In that case you have preview-generation enabled anyway.

Yes, I do have the External Storage Support app and have several drives configured using SMB/CIFS.

So you’re saying that because this app is enabled, file scan for external files is already happening? Do you know when and how often? Would you happen to know which OCC command is being invoked? Thanks.

Yes :slight_smile:
Just try it. I think NC is taking advantage of SMB/ CIFS features here to get file information.

If you go to your external storage configuration and click on the three dots (…) on the right of every configured storage, you can enable previews and also choose when to check for changes (“On Access” or “never”). So you better leave it to “On Access”.

There is not an OCC command for every internal function. I didn’t notice an occ command for scanning files on external storage, so I think there is none.

What you should probably know: file:scan is actually for storage which is not integrated via APIs (or say apps in NC).
So for example when you connect to your server via FTP/ SSH and create a new text file in your users data directory, you won’t see this file when you access your server with the Browser. That’s because NC doesn’t know (cause you didn’t use NC APIs) that the file is there.
In that case you can run the files:scan command and NC will detect that file and make it available via web GUI (browser) as well.
Saying that: every time you access any storage which you have never scanned before and you see all the files, there is no need for a scan. NC is already taking care of that then. And that’s the case for external storage.