QwikTest
Search…
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.
1
/usr/local/bin/php path-to-your-project/artisan schedule:run >> /dev/null 2>&1
Copied!
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.
1
$ crontab -e
Copied!
and add the following line to it.
1
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
Copied!
Replace the project path with your application path.
Now reload cron service.
1
$ sudo service cron reload
Copied!

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.
1
$ php artisan schedule:work
Copied!
If it is windows, then open the command prompt and run the following command.
1
C:\xampp\htdocs\app_folder> php artisan schedule:work
Copied!
Last modified 4mo ago