Nextcloud version : 22.2.6
Operating system and version : debian 11
Apache or nginx version : Apache 2
PHP version : 8.1
The issue you are facing:
Hello everyone,
i’m trying to automate a scan with OCC command using crontab (daily scan). But when the time for the crontab comes, it simply does nothing. No scan at all. I can confirm that because i’ve added /modify files before and after the crontab schedule, i can’t see any of my modification in NC.
In addition to what @Vincent_Stans stated you also have to specify a time when the command should be executed. You can use https://crontab.guru to get the correct syntax.
If you for example want to run it daily at midnight you could use the following line:
For example create a file in the root of your nc data-directory named files-scan.sh or name it however you like and put it wherever www-data can read it.
Do place your command in this file.
echo “/usr/bin/php /var/www/nextcloud/occ files:scan --all --verbose 2>&1 >> /tmp/nextcloud_rescan_debug.log” | tee -a files-scan.sh