Cron Jobs

Upon installing Latch, the installer tries to add a cron job that executes once per minute. This job calls lib/hooks/cron.php, which triggers the cron event.

Extensions can add a cron event listener for scheduled activities. For example, the Backups extension's lib/events/cron.php checks configured backup jobs and runs only the jobs that are due.

Debugging Cron Setup

On Linux hosting, the generated crontab entry should look similar to this:

* * * * * '/usr/bin/php' '/home/myacc/public_html/lib/hooks/cron.php' >> '/home/myacc/cron.log' 2>&1

The exact PHP binary and paths vary depending on your hosting setup.

If scheduled activities do not appear to be working:

  1. Check that the crontab entry exists.
  2. Confirm that the path to cron.php exists.
  3. Confirm that the selected PHP binary is executable.
  4. Examine the cron log for diagnostics.

Automatic setup is skipped on Windows. Use Windows Task Scheduler if you need scheduled jobs in a Windows environment.

Reinstalling The Cron Job

You can rerun the cron job setup after installing Latch. Log in with an Administrator account, then visit:

YOUR_WEBSITE/install/setup_cron.php

This is useful if an extension overrides lib/hooks/cron.php; setup resolves the cron script through Latch's extension-aware file loader.