Setting up CRON JOBS

CRON Job Setup Guide.

CRON Jobs are responsible for running background process for following tasks

  1. Product price change reflect live on user's cart .

  2. Wallet points expiry check.

To set-up cron job you need to follow below guide.

For cpanel and shared hosting

  1. Go to cpanel dashboard and find advanced and open cron job tab

2. After opening cron job you will see similar settings. For more information check below screenshot. Paste the command in Command input box

path of php /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

After adding new cron job you will see similar output as in below screenshot.

For ubuntu servers

To start the Laravel Scheduler itself, we only need to add one Cron job which executes every minute. Go to your terminal, ssh into your server, cd into your project and run this command.

sudo crontab -e

This will open the server Cron tab file, paste the code below into the file, save and then exit. Make sure your replace path-to-your-project with your project directory ex. var/www/html/projectdirectory

* * * * */usr/bin/php /var/www/project/artisan schedule:run >> /dev/null 2>&1

For Check Cron Job is running or not after setup your cron job reload your site homepage and go to your project directory and open storage/logs and open file laravel.log. You will see a message like this

Check if Ubuntu cron working fine or by hitting this command In Ubuntu, the cron service should start automatically. You can check it with these commands:

sudo service cron status # checks if cron is running
sudo service cron start  # starts it
sudo service cron stop   # stops it

For Localhost

For users who testing script on localhost like laragon, xammp, wammp or other tools after run project go to project directory and open terminal/command prompt and hit command

php artisan schedule:run

You will receive following similar output

Last updated