CRON Job

Important Note : After Setting CRON JOb in capnel you need to On CRON in Theme options See How to On CRON Via Theme Options.

What , Why & How to set Server CRON Jobs

What is CRON? 
Used for scheduling tasks to be executed sometime in the future.  Every quality hosting has a “scheduling system” also known as CRON. The purpose is to run periodically maintenance scripts, that take care of certain jobs needed for your site. It’s like the Task Scheduler on your Home computer, just it runs programs in your hosting account.

Why is a CRON needed?
Since Theme scripts are triggered just upon visiting the site, there can be that for a longer or shorter period of time there is no visitor to your site. But there could be tasks needed to run at a specific time. For instance, auctions must expire on 00:00:00 hours, and emails must be sent to users involved in this auctions.

Let me give you few examples:

  • Checking end time for Live Auctions and if their time is due then expire those auctions.
    1.  Change status of auction products from live to expired
    2.  Send winning email to the winner
    3.  Send winning SMS to the winner
    4.  Perform Automatic Debit of winning amount from their credit card
  • Checking start time for Future Auctions and if their time is due then make those auctions live.
  • Send Emails & SMS Notifications for specific actions
    1.  Whatsapp SMS
    2. Text Message
    3. Payment Reminder
    4.  Bid and OutBid Notifications
    5.  Winning Notifications

Since your website can perform these above actions properly and without any visitor, you as admin have to set the below parameters inside your hosting server and then our plugin will ensure that events, emails, SMS ,Whatsapp SMS associated with auction products will be processed and sent on a timely basis.

Cron Jobs with URL

Auction Process : We have create one cron Job for all process. Need to set only one cron job all other setting are in theme options.

wget -q -O -  https://example.com/?ua-auction-cron=uat-process-auction >/dev/null 2>&1
  • Recommendation: We recommend you set it to every minute.

So, the admin can use a different cron job URL same as shown above. Make sure to replace your URL with example.com.Different command used in cron job URL shown above. Below is a description of each command.

  • wget - command is used to hitting a PHP script can be achieved by using cron. Wget's -­q or –quiet option turns off wget’s output which is exactly what we want since we do not intend to generate content but only hit the PHP script.
  • /dev/null - The purpose of this is to suppress any output from the command itself. accepts and discards all input, produces no output (always returns an end-of-file indication on a read).
  • 2>&1 - ">"  redirects output to a file, overwriting the file. ">>" redirects output to a file appending the redirected output at the end. Standard output is represented in bash with number 1 and standard error is represented with number 2. They are separate, so the user can redirect them to different files. 2>&1 redirect the standard error to the standard output so they appear together and can be jointly redirected to a file. (Writing just 2>1 would redirect the standard error to a file called "1", not to standard output.)

Please review the below video for cronjob URLs. This video will cover how to set the Cronjob URLs on the cPanel and set up the theme options for the Cronjob.


How to add cron job to hosting cpanel

So let's understand step by step how to add create cron job in the hosting control panel.

Step 1 - First login to the hosting control panel which you are using.

Step 2 - After logging in, there will be an option to create cron job in cpanel. In most of cpanel this is in the Advanced section at the bottom. 

Step 3 - When click the button for cron job, the form will open for URL and common setting.

Step 4 -  Select the option from the dropdown of the common setting. It is commonly used time and date interval. We have given time recommendations for different cron jobs above. This setting is the same in all hosting cpanels. let's understand the different options of this dropdown.

  • Minute – This menu allows you to select the number of minutes between running the cron job or the minute each hour on which you wish to run the cron job.
  • Hour – This menu allows you to select the number of hours between running the cron job, or the hour each day on which you wish to run the cron job.
  • Day – This menu allows you to select the number of days between running the cron job or the day of the month on which you wish to run the cron job.
  • Month – This menu allows you to select the number of months between running the cron job or the month of the year in which you wish to run the cron job.
  • Weekday – This menu allows you to select the day(s) of the week on which you wish to run the cron job.

Step 5 - Add cron job URL which you want to create it Four cron job URLs are displayed above. Add one of them and submit it.Path to curl can be “/usr/local/bin/curl”, “/usr/bin/curl” or set “wget -q -O –“ etc. The best way to make sure you have the exact path to curl is to contact your hosting support (and ask them to help you set up cronjobs, after all, they're there to help you with things like these).

Step 6 - To check if cronjob works you can create one sample auction, which ends in a minute, or two and then wait for the auction finished email notification.

Example of different types hosting cpanel

  • HostGator - First login to HostGator control panel. After that go to advanced Settings which is appears in cpanel dashboard. There you will see the cron jobs option as per the below image. Click on that option.

    Now, first, do common settings as explained above and then add cron job URL as per the below image. In the example, we have added the URL for the auction status cron job. Admin can add any URL of four cron jobs.



  • Bluehost - First login to Bluehost control panel. After that go to advanced Settings which is appears in cpanel dashboard. There you will see the cron jobs option as per the below image. Click on that option.

    Select common setting options and add cron job URL as per the below image.

  • Cloudways - Login to Cloudways dashboard. Click on the cron job management option which appears in the left sidebar. In the cron job management menu, there is an option to add a new cron job. The below form will be open after clicking the "Add new cron job" button. Select the time option for cron job from dropdown, add cron job URL, and submit it.

  • Godaddy - For this setting, we provide the below document link which is helpful. 
    https://in.godaddy.com/help/create-cron-jobs-16086

Easycron

If your hosting company does not support one-minute cronjobs. we suggest that you move your website to a more serious hosting company or use a service like EasyCron. The steps to set the EasyCron are shown below.

Step 1 - Open your cron job dashboard. Register or login to the dashboard.

Step 2 - Firstly, click on the " Cron Job" button.

Step 3 - In the field "URL to call", enter the following URLs respectively for each cron job:

  https://example.com/?ua-auction-cron=uat-process-auction (cron job run "every minute")

 ( Note: Make sure to replace your URL with example.com).

Step 3 - If necessary, finish the other optional settings.

Step 4 - Click the "Create Cron Job" button. You're done! EasyCron will trigger your Auctions' cron job script dutifully according to your time setting.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.