The app states the following cron entry is required under the web user: ./occ preview:pre-generate
Could I please request some clarity on how a cronjob should look? Here’s my initial attempt, though I feel it’s wrong: */30 * * * * php ./occ preview:pre-generate
NC is installed under /var/www/html/ and normally I CD to the dir before running OCC commands, hence my query.
I just reviewed my crontab and found: */15 * * * * /usr/bin/php -f /var/www/owncloud/cron.php
for my cronjob. So as here I guess the path to your nextcloud instance is necessary, the one to php should be not in most cases ;).
Hmm I don’t know what the "-f" does. I just got it from admin manual here.
My preview cronjob now looks like this: */60 * * * * /usr/bin/php /var/www/owncloud/occ preview:pre-generate
Will see what happens…
€: Ah, i guess the "-f" stands for “file”, so is necessary for the following path/file to be used with the php command as wanted.
Usage: php [options] [-f] <file> [--] [args...]
php [options] -r <code> [--] [args...]
php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
php [options] -S <addr>:<port> [-t docroot]
php [options] -- [args...]
php [options] -a
-a Run interactively
-c <path>|<file> Look for php.ini file in this directory
-n No configuration (ini) files will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f <file> Parse and execute <file>.
...
So "-f" should be necessary for the command to work properly. Or maybe it is smart enough to use the argument as file, if nothing else is given? Did you check if the preview generation worked for you without -f?
Without -f it works fine, similar to php /var/www/html/occ files:scan --all works fine without -f also.
Presumably -f is used in the above due to it being a php file rather than whatever occ is?
#!/usr/bin/env php
<?php
/**
* Copyright (c) 2013 Thomas M ller <thomas.mueller@tmit.eu>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
//$argv = $_SERVER['argv'];
require_once __DIR__ . '/console.php';
It’s also some kind of php file. I tried sudo -u www-data php /var/www/owncloud/cron.php to verify and the admin panel shows, that the nextcloud cron job was successfully done. So "-f" doesn’t seem to be needed or is applied automatically .
Now preview/thumb generation for the gallery app would be nice to make the holiday slide show on my rpi a little more fun ;).
I have installed this preview generator app, but it doesn’t seem to do anything… and is poorly documented, if not at all…
My cron job */30 * * * * php -f /var/www/nextcloud/occ preview:pre-generate
runs without error under the user www-data. (checked in my syslog)
I have remarked that in the “/var/www/nextcloud/apps/previewgenerator/lib/Command” directory, there is 3 possible command :
DeleteOld
Generate
PreGenerate
Is the differences in capital letters and writing of “pre-generate” in the cron and “PreGenerate” in the file could be the problem ?
Also, my /var/www/nextcloud/apps/previewgenerator/appinfo/database.xml seems not updated and the oc_preview_generation table in the nextcloud database empty…
I also recognized, that there are no new previews generated for my nextcloud, where the cronjob is done successfully every hour.
But the command is correct. If you try sudo -u www-data php /var/www/owncloud/oc preview:PreGenerate you will get
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "preview:PreGenerate" is not defined.
Did you mean one of these?
preview:pre-generate
preview:generate-all
preview:delete_old
I don’t know where these commands are defined, but they are. I try preview:generate-all at the moment. It takes time, so seems to be promising. Maybe pre-generate does only work for new files or something to not always need to scan the wohl data directories.
preview:generate-all is still working while i am typing. I will give you results, when it’s done .
preview:delete_old - Will delete your old preview folder. This is no longer used. Note that there is a background job that will do it in time from the server. But this was just for me to quickly get it done.
preview:generate-all - Will loop over all files and try to generate previews. This can take a long time just to traverse if you have a lot of files. You should only have to run this once.
preview:pre-generate - As long as the app is enabled it will listen to new / edited files. It stores those files in a list and then when this command is run it will try to create previews for those files.
So long story short:
Run ./occ preview:generate-all once
Run ./occ preview:pre-generate in a cronjob after that.
As the app is just one week old, we will accept missing documentation .
To get this clear:
This app is (just) for the preview generation of the files app/nextcloud itself, if 'enable_previews' => true, and has for the first nothing to do with the thumbnails of the gallery app, right?
Or is there some merge of the previews and the thumbs system planned?
@preview:generate-all: Maybe there could be some hint after app installation to run this one, maybe even through the nc web interface and then just run in the background?
So I made the mistake of running the generate-all command on a putty session with 70GB of files before I read the old thumbnail directory is no longer being used. So much for it ignoring existing thumbnails then? [quote=“MichaIng, post:16, topic:6144”]
This app is (just) for the preview generation of the files app/nextcloud itself, if ‘enable_previews’ => true, and has for the first nothing to do with the thumbnails of the gallery app, right?
[/quote]
Where did you see mention of 'enable_previews' => 'true'?
Me too, but as I already had problems with broken ssh connections I use screen. This enables you to set sessions into the background and resume lost ones .