OpenCart – How to Setup CRON

What is CRON?

WIKIPEDIA DEFINITION

Cron is the time-based job scheduler in Unix-like computer operating systems. Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates. It is commonly used to automate system maintenance or administration, though its general-purpose nature means that it can be used for other purposes, such as connecting to the Internet and downloading email.[1] The name cron comes from the Greek word χρόνος [chronos] for time.

MY DEFINITION

Cron is a way to automate / execute scripts based on time intervals. It allows the user set up procedures that will fire according to the times set up on the Server. Typically, a URL is fired and that URL will execute a script that is located on the server (PUBLIC_LEVEL)

Setting up a CRON JOB

If you have an Arvixe hosting account then you will have already been inside your cPanel. Within the cPanel you can set up a CRON JOB very easily. Login to cPanel and scroll down to Advanced.

Click on Cron Jobs

Now all you have to do is specify a time interval(s) for your new Cron Job.

Lastly, specify a COMMAND. This is important because without the command line being accurate the script will not fire. Your command line will be the PATH to the script and will typically look like this:

usr/bin/php -q /home/username/public_html/yourfilename.php

Note: With Cron you cannot access a file within the main core class of Opencart with Shell command. You have to access an isolated PHP file. Just use cURL to access a real URL inside the base class.