Task Scheduling
Learn how to setup CRON jobs for task scheduling
Test schedules that end will need to mark as expired. For that, we only need to add a single cron configuration entry to our server that runs the schedule:run
command every minute.
Setup Cron Job on Shared Hosting
To set up the cron job in shared hosting, follow the below steps.
Login to cPanel, go to the Cron Jobs page & add a new con job.
Minute, Hours, Days, Month, Weekday need to be set to *
In the command input field, give the following command.
Change the path and PHP version according to your hosting.
Setup Cron Job on Cloud VPS
To set up the cron job, use the following command to edit the crontab file.
and add the following line to it.
Replace the project path with your application path.
Now reload cron service.
Run Cron Job on Local Host
Typically, you would not add a scheduler cron entry to your local development machine. Instead, you may use the schedule:work
Artisan command. This command will run in the foreground and invoke the scheduler every minute until you terminate the command:
To run Cron Job on the local machine, go to the application folder and run the following command.
If it is windows, then open the command prompt and run the following command.
Last updated