Clarity on the crontab settings for the preview generator app


I can confirm this problem with the occ preview:pre-generate command with an MP3 file w/o cover. In my case it is one file of a series of single channel frequency tone files from


Not the only one!

In the worst case your box is getting frozen.

I would suggest to downgrade it to beta state until the bugs are not fixed.


Yeah I know the app is not perfect. At the moment I simply don’t have the time/priority to work on this in my free time.

But pull requests are welcome



I’m getting following error on nextcloud box after preview:generate-all and preview: pre-generate

ERROR: object ‘/usr/lib/arm-linux-gnueabihf/libarmme
.so’ from /etc/ cannot be preloaded (cannot op
n shared object file): ignored.
The process control (PCNTL) extensions are required in case
you want to interrupt long running commands - see http://ph
There are no commands defined in the “preview” namespace.

I appreciate if someone could help…


Hmm, app is definitely enabled successfully? Did you try to remove it and redownload/enable?


I reenabled the app and rebooted the server. Still the same error… Someone else opened an issue with the same error on different commands on nextcloud-snap github…


Yes that’s true, I also did see PCNTL errors on two other topics in combination with nc box/snap.


What in case we copy files into a nextcloud user’s folder directly on the file system - is it succicient to run files:scan to get them added to the mentioned list?


What happens if files are deleted directly from the system? Will the preview-files still be stored on the disk?


in my config.php:
‘preview_max_x’ => 256,
‘preview_max_y’ => 256,
‘preview_max_scale_factor’ => 1,

in Generate.php and PreGenerate.php:

$maxW = (int)$this->config->getSystemValue(‘preview_max_x’, 2048);
$maxH = (int)$this->config->getSystemValue(‘preview_max_y’, 2048);

$s = 256;
while ($s <= $maxW || $s <= $maxH) {
$this->sizes[‘square’][] = $s;
$s *= 2;

$w = 256;
while ($w <= $maxW) {
$this->sizes[‘width’][] = $w;
$w *= 2;

$h = 256;
while ($h <= $maxH) {
$this->sizes[‘height’][] = $h;
$h *= 2;

As a result, in my /preview catalog only 2 files (for each *.jpg) are generated instead of ten or more files (170-170crop.png and 256-170max.png). This greatly accelerated my server based on Pi.
But if I manualy delete files from Linus file system, NC don’t understand this. What method may be used for cleaning database records?


Since the generation of images takes time on a slower board like a RP3 and the preview command is in a cron job, what happens if I set the cron for every hour and the cron runs the job again while the previous job has not completed? Will it detect that the job is already running and exit gracefully?

Thank you


@rullzer what say you?



You can start the cronjob like that to find it out:

*/20 * * * * php /var/www/nextcloud/occ preview:pre-generate >> /var/ncdata/preview.log


Sorry for digging this thread up, but does anyone here have experience with hosted systems i.e. from
My nextcloud instance is running on one of their hosted packages and my suspicion ist that there is no way I can run the cronjobs needed there without terminal access?

sorry, complete noob here :frowning:


Looks like you need to pay to enable it:


You’ll need the hosting package “PrivatPlus” in order to be able to use cronjobs.
When you only have the package “Privat”, there are no cronjobs available (see here).


Sorry for not clarifying it im on the PrivatPremnium package, and now i found cronjobs, but it only gives me these options:

In Github there is written:

  1. Add a (system) cron job for ./occ preview:pre-generate

Idk how to go from there.
Should I copy the ./occ preview:pre-generate in the cron.php? And if yes, where?
I tried so find some videos about it, tbh now I’m even more confused…thank you for your help guys


Ok, so you can’t call ssh scripts directly. Maybe this will help.


Thank you, seems like I’m not allowed to run this command on all-inkl:

    [0] => sh: ./occ: Permission denied

Does anyone have a recommendation for a hoster that allows this? Nextcloud run awfully slow, I use it for my private photo database and right now, there are around 200 GB of photos in it.

UPDATE: If anyone has the same problem: all-inkl support did edit my script so that it works:

<?php exec("php70 occ preview:pre-generate 2>&1", $out, $result); echo "Returncode: " .$result ."
"; echo "Ausgabe des Scripts: " ."
"; echo "
"; print_r($out);

Turns out I’m not on a server with OPchache enabled, that also contributes to the slow performance, they will move me to a server with OPcache enabled.
Thank you all for your support