Setup CRON

11. Setup CRON JOB

A cron job is a scheduled task in Unix-based operating systems that runs scripts or commands at specified intervals. Here’s how to set up a cron job on a server:

Steps to Set Up a Cron Job:

11.1. Log in to cPanel or in your web server
11.2. Navigate to the “Cron Jobs” Section
11.3. Add a New Cron Job

In the command field, enter the command or the path to the script you want to run.

For example: Run a script every minutes:

* * * * * /usr/local/bin/php /home/username/public_html/artisan schedule:run >> /dev/null 2>&1

For example: Run a script every day at midnight:

0 0 * * * /usr/local/bin/php /home/username/public_html/artisan schedule:run >> /dev/null 2>&1

11.4. Save the Cron Job

Important Notes:

Ensure the script you’re running has the correct permissions and is executable. You need to specify the correct PHP path (/usr/local/bin/php is common but may vary depending on your server setup) and please use your admin panel path in the CRON JOB command.