IT in Education

How to trigger cron jobs

nextcloudThere are three options for triggering background tasks, Ajax, Webcron and Cron. This article describes how to set up cron on your web server.


Ajax by default

Note that by default background tasks are triggered using Ajax, which means that they will run every time someone accesses Nextcloud using a browser. This will be fine for a single user, but could overload the server if you have more than a few users.

Web host

To run Cron jobs, you need to create the task on your web host. Here is the cron command that worked for me.

php /path/to/root/directory/cron.php

I set it to run every 5 minutes:

*/5 * * * *

Note that I recently found that I needed to include the version of PHP that I was using, which made the command look like this:

php8.2.9 /path/to/root/directory/cron.php

Nextcloud

Now you need to log on to your Nextcloud instance with an admin account.

  1. Click your Avatar (top-right) and choose Administration Settings.
  2. In the left pane, in the Administration section, click Basic Settings.
  3. In the Background Jobs section, make sure that the Cron (recommended) option is selected.


Thanks for visiting,
Steven