How to know if Preview Generator is working?

I have this set up as a cron job. The command sudo -u www-data crontab -l shows:

0 3 * * * php /var/www/html/nextcloud/occ preview:pre-generate

When I run the preview command manually, it takes several seconds and ends, so I’m assuming it works, but how can I see if the cron job execution is working correctly? Which log can I check? Thanks.

pre-generate command will do generate previews only for a new medias. To generate preview for already known medias you need to run it with


And possible follow this procedure:

You can also use -v, -vv or -vvv keys to see output of the command.

Also check your .../nextcloud/data/app_XXXXX/preview folder this is where preview are saved.

I know how to run it but I’m asking how I can verify that the CRON job for it is running in the background? I’m not sure how/where in the logs to check.

CRON jobs are most likely to be logged in /var/log. On my Ubuntu server the CRON jobs can be found in auth.log AND in syslog.

For me i get the output of each scan result posted into /var/mail/root, so on sudo vi /var/mail/root shows me all scans ever run, by typing G (capitol) i reach the end of file whee the latest scans are. It is in the root folder as the scan command needs to be run by root.

Wrote a script for me, that will put information about preview generation process into NC log:
As per here The cron job ? previewgenerator just run it as your NC user each e.g. hour. Check it out:

1 Like

I use the following SQL to verify if pre-generate is running:

from_unixtime(fc.mtime) as last_changed
from preview_generation pg,
filecache fc
where pg.file_id = fc.fileid

If cron succeeded the result should be empty.