Preview Generator // check status and cronetab


i installed the preview generator app at NC admin. Then i execute the sudo -u www-data /var/www/nextcloud/occ preview:pre-generate.
How can i check now if everything is working fine? I got no feedback after the execute.

Second question: is it enought to but this piece of code at the crontab from ubuntu?
*/15 * * * * sudo -u www-data /var/www/nextcloud/occ preview:pre-generate.

Best regards!

Hi @Django3

To be sure the command works, you should run it once as root user and see if you receive any error messages.
However, your command should rather look like this:
*/15 * * * * sudo -u www-data php /var/www/nextcloud/occ preview:pre-generate

To see if the command actually did something, you can check the preview folder within you ncData folder with ls -ltr. For example:
ls -ltr /var/ncdata/appdata_oc493837239/preview/

If there were new photos on your server and you run preview:pre-generate then there should be new folders:

ls -ltr /var/ncdata/appdata_oc493837239/preview/ | tail -3
drwxr-x---     2 www-data www-data   4 Feb 18 14:46 119488
drwxr-x---     2 www-data www-data   4 Feb 18 14:46 119496
drwxr-x---     2 www-data www-data   4 Feb 18 14:46 119455
1 Like

OK, thank you!
But the first problem: i can’t find a folder called “ncdata” at /var/ . :confused:


That was just an example. I actually don’t know where you placed your data directory :slight_smile:
You can quickly find that information when you copy and paste this command in your command line of your server:
grep datadirectory /var/www/nextcloud/config/config.php

Pick the directory which is listed there and run the ls -ltr command against that directory and the subfolder with the name like “appdata_oc[a bunch of numbers]/preview”

Or you can run this command :wink:

ls -ltr `grep datadirectory /var/www/nextcloud/config/config.php | awk '{print $3}' | sed -r "s/'(.*)',/\1/"`/appdata_oc*/preview/ | tail -20

Ah, sorry the data folder, for sure, i misunderstood you. :wink:

Ok, i tried it - i saw a new file in the preview folder BUT also without running the preview:pre-generate … could this be? I can see the new preview file immediately after uploading something.

In this case, execute the preview:pre-generate would be useless as cronjob?

Did you upload the file via web GUI?
Previews are also generated on access. So let’s say you upload a photo via web GUI, the folder will be refreshed and you instantly see that photo in the current folder. In that case you directly request a preview and the preview file will be created.
If you on the other hand upload photos with the NC client (auto upload) then these files are not accessed after upload and there should be no preview generated for these files.

That’s pretty much the use case of the app. Photos have been uploaded in the background and especially with very big folders you don’t want the previews to be generated on the first access, as this might take a while and doesn’t feel as good as previews that are instantly there.

1 Like

Geat, thanks a lot for your explanation! :slight_smile:
Yes, this time, i used the web GUI but most time i am using the app and also auto uploading.

I will test it again with the app.

Best regards!

1 Like