Skip to content

Knowledgebase

Scheduling Laravel tasks through cron

development

Laravel keeps application schedules in code and uses a regular scheduler invocation to decide which tasks are due. This is easier to maintain than adding an unrelated operating-system cron entry for every task.

What you need before you begin

Confirm cron access, the correct CLI PHP path and your application timezone. Review each scheduled task for its resource use, overlapping execution and effect on customer data.

01 Schedule Laravel tasks through cron

  1. Define a small test schedule in the supported location for your Laravel version. Give it a harmless, observable outcome such as writing a specific private log message.

  2. Use the panel scheduled-task feature to invoke php artisan schedule:run from the full project directory at the interval Laravel requires. Use an absolute PHP path when the server offers multiple runtimes.

  3. Capture errors in a private log while testing. An incorrect working directory or CLI PHP version can fail even when the website itself runs normally.

  4. Use the framework overlap and single-server controls where suitable. Their locks require a working cache backend and, for multiple servers, an appropriate shared store.

  5. Remove the temporary test task, enable the real schedule and document the expected execution times. Review behavior around timezone and daylight-saving changes.

02 Example: configure the scheduler as one deliberate cron entry

After confirming the actual PHP path and private log directory, a typical Laravel scheduler entry looks like this. Replace the paths with those assigned to your service and run the corresponding command manually in the same account before enabling the schedule.

Code or configuration example
* * * * * cd /home/ACCOUNT/apps/portal && /usr/bin/php artisan schedule:run >> /home/ACCOUNT/private/scheduler.log 2>&1

Use php artisan schedule:list from the application directory to inspect due times. The one-minute cron entry evaluates schedules; it does not mean every application task must run each minute. Choose supported overlap protection for long tasks and keep the scheduler’s environment consistent with the web application.

Expected result: A harmless scheduled staging task records the expected time and completes without duplicate runs. The private log captures a wrong interpreter or missing dependency during setup, instead of discarding all errors before the scheduler is verified.

Confirm the expected result

Use the schedule listing command and check actual execution timestamps. Confirm a long task does not create multiple competing copies on successive cron runs.

Troubleshoot unexpected results

If nothing runs, test the same command as the same account with the same environment. Check quota, execution permissions and log paths before changing the schedule frequency.

A common question

Should every Laravel task run once a minute?

The scheduler invocation can be frequent while individual tasks run hourly, daily or on their own schedule. The task definition determines when work is due; cron starts the decision process.

Sources and further reading

Was this answer helpful?

Need a little more help?

Our support team can help you find the next step.

Contact support