Editing Crontab

Don’t forget to add your topic to the Howto/FAQ Wiki!

How does one edit the crontab for things like the preview generator?

You need to build the whole line of code first. I like to use this site to get all the frequency things right. They suggest every 10 minutes.

Your command (assuming everything is default), running from ssh:

sudo -u www-data php /var/www/nextcloud/occ preview:pre-generate

But you don’t need to specify the sudo in crontab, because it will be already running from that user, so, it is just:

php /var/www/nextcloud/occ preview:pre-generate

Therefore, the input in crontab:

*/10 * * * * php /var/www/nextcloud/occ preview:pre-generate >/dev/null 2>&1

Open the crontab from that user specifically:

sudo -u www-data crontab -e

Insert the code at the end of the document. Hit return to insert a new empty line. Save. Close.

Check the cron logs

sudo cat /var/log/syslog | grep cron

That’s it.

Thanks for the reply. However, what container does this need to be specified in? I tried under the nextcloud-aio-nextcloud container but cron isn’t installed, I can’t even use apt command.

My instructions above are for the default installation without docker. I can’t help you in this case but you should give more details and perhaps someone can eventually help.

Hello @foxhoundvenom,
can you please open a new thread here?

I’ll try to answer your question there then. Thank you! :slight_smile: