Setting Cron Job

Now you need to create cron job on your server.

For cpanel and shared hosting

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

After opening cron job you will see similar settings. For more information check below screenshot. Run the command

php /path/to/set_top_detail

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/set_top_detail

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. 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

Last updated

Was this helpful?