Show last occ files:scan

Hello y’all
i’ve added sudo -u www-data php /var/www/nextcloud/occ files:scan --all to www-data’s crontab but i don’t have no idea how to show when did the last occ scan ran.
The cron stats everydat at midnight.
Is there a log file or something where i can see if it works or not

Thanks for your help.

Maybe there is is logging for cron e.g. under /var/log/...
But you can also post the output of the scan to a file:

Not tested. Add to your command:
&> /path/to/your/logfile.txt
or
>> /path/to/your/logfile.txt 2>&1

Both send stdout and sterr to your file.

Okay
thanks a lot
i’ll try that and let u=you know :slight_smile:

Hi, i’ve tried this one &> /path/to/your/logfile.txt but no logs
i’m going to try the 2nde one.
My command looks like this :

00 00 * * * sudo -u www-data php /var/www/nextcloud/occ files:scan --all >> /var/log/NextcloudScan.log 2>&1

is it right ?

Yes and no. The command seems to be ok but the user www-data bust be allowed to write the file in /var/log/ .

Maybe you must create a directory
sudo mkdir /var/log/nextcloud
and set the correct rights
sudo chown www-data:www-data /var/log/nextcloud
Also change your command to:
00 00 * * * sudo -u www-data php /var/www/nextcloud/occ files:scan --all >> /var/log/nextcloud/NextcloudScan.log 2>&1

Please improve your linux knowledge. In case of error you might need it.

image
I’ve already done that ww-data is the owner of var/log/nextcloud/NextcloudScan.log.
Thanks.

I’ll try this

Yes. But if you delete the file and create it again you must set the rights also again. With a directory there is not this problem.