Setting Up the Cron Job

A cron job is essential for automating recurring tasks in Davinc AI, particularly for renewing subscription usages.

Frequency and Interval

  • Recommended Interval: The cron task should run once per minute for optimal performance.
    Some hosting providers may limit cron tasks to a minimum interval of 5 minutes. In such cases, CRON tasks will still work as needed, but there might be a slight delay of up to 5 minutes.

Configuring the Cron Task

To set up the cron job, add the following entry to your server’s crontab:
* * * * * /usr/local/bin/php /path/to/app/root/artisan schedule:run
This command runs the Laravel schedule command in your Davinci AI installation directory every minute.
Replace /path/to/app/root/ with the actual path to your Davinci AI application’s root directory.
Double check that /usr/local/bin/php is needed path where your php bin folder is located. Every hosting is different hence it might differ from hosting provider to hosting provider.

Set up CRON job in Cpanel

Every hosting provider might have different CRON setup page and different path for PHP bin directory. Instructions below are provided based on our hosting - Namecheap, so path to PHP Bin and path to script can be different. Check with your hosting provider if you are not aware how to setup similar CRON job in your environment.

Configuring the Cpanel Cron Job

1

Step 1

In your Cpanel find CRON Jobs option, it could be under Advanced panel as shown in the image.
2

Step 2

In the CRON Jobs panel add a New Cron Job. Select the minimum time that your hosting provider allows you to run a Cron Job (minimum you can get is 1 minute).
Not every hosting provider allows you to run Cron Jobs every minute, for example shared servers of hosting provider (Namecheap) allows to run only every 5 minute.
3

Step 3

Copy paste the command show in the first red box into the Command field.
/usr/local/bin/php /home/username/YOUR_DOMAIN_PATH/artisan schedule:run

Please note that above path of PHP bin directory and path for the directory can be different in your case. You might want to check with your provider to figure out where PHP bin folder is located in your hosting provider.
4

Step 4

After creating a CRON Job successfully you will see it listed among your Current Cron Jobs list in your Namecheap hosting platform for example:
5

Step 5

In case if your hosting allows you to enter entire CRON job command at ones, you can enter it in the following way (Keep in mind that if your hosting allows you to run tasks every minute, you will need to change */5 to */1):
*/5 * * * * /usr/local/bin/php /home/username/YOURDOMAINPATH/artisan schedule:run
6

Step 6

You have successfully configured the CRON via Cpanel for Davinci AI

Set up CRON job in Plesk

You might want to follow these instructions for Plesk at least on the setup part

Troubleshooting Cron Issues

If you encounter problems with running CRON Jobs:
  1. Verify the cron task configuration is correct.
  2. Check your server logs for any error messages related to the cron job or renewal process.
  3. Ensure that the PHP path /usr/local/bin/php is correct for your server.
If issues persist, consult with your server administrator. They can help diagnose server-specific problems, verify cron job configurations, and ensure proper file permissions. If you still need assistance after consulting your server administrator, please don’t hesitate to contact our support team directly for further guidance.