You’re Invited! Nextcloud Conference on October 1 & 2 in Berlin!
We can't wait to see you again at the Nextcloud Conference 2022, our premier community event taking place from October 1-4 in Berlin!Read More
September 20, 2018
Guest post by @morph027
If you’re using the fantastic Nextcloud and like to feel comfortable browsing all your auto-uploaded photos like once upon a time you did in some proprietary Picasa or so, you can benefit from the Preview Generator, which will take care of pre-rendering the thumbnails. This means faster, smoother scrolling and previewing your images, both in your browser and on mobile devices!
As it states you must add some cron magic to get it working and the Nextcloud folks asked for a tutorial, here’s how to do it with cron or (my preference) with systemd timers.
httpd, … – depends on your distribution). You can find out by looking at the owner of the nextcloud files using
occfile, depends in which folder your Nextcloud has been installed (e.g.
Add or create a new cronjob for the Nextcloud user:
crontab -e -u www-data
Using your favourite editor, add something like this, which will run the job at 04:00:
0 4 * * * /usr/bin/php -f /var/www/nextcloud/occ preview:pre-generate
Systemd also has the possibility to run specific tasks at specific times or events. called Timers. You need to create 2 unit files:
[Unit] Description=Nextcloud Preview Generator [Service] Type=oneshot User=www-data ExecStart=/usr/bin/php -f /var/www/nextcloud/occ preview:pre-generate [Install] WantedBy=basic.target
[Unit] Description=Run Nextcloud Preview Generator daily at 04:00 [Timer] OnCalendar=*-*-* 4:00:00 Persistent=true [Install] WantedBy=timers.target
systemctl enable nextcloud-preview-generator.timer
systemctl start nextcloud-preview-generator.timer