Joomla Tutorials and Blog Posts

JPrc Cronjobs Provides Cron for Joomla

Cron is a very useful, but sometimes confusing, tool for managing websites.
 
Cron can simply be described as a scheduling calendar. You can use it to set up a "cronjob". Examples of tasks that are run by cron jobs are automatically backing up your site and sending emails.

Cron is a feature of many servers but is sometimes unavailable to the user. For example, Godaddy does not give users access to cron.

Using the JPrc Cronjobs extension, we'll show in this tutorial how anyone can use cron on their Joomla site.

Notes before we start

JPrc Cronjob isn't technically a cron function, but it does an accurate simulation. 

JPrc Cronjob is activated when a visitor lands on your site. For example, if you set JPrc Cronb to run at 3:00am, it might run 3:10am if that is your next visitor.

If you have a low traffic site, or you need it to run without being dependent on traffic, you'll need to use a host that offers cron, or sign up for one of the free web services that will manage cron for you.

Step 1: Download and install JPrc Cronjobs

  • Get JPrc Cronjobs from the JED.
  • Install JPrc Cronjob using the Joomla Extension Manager.
  • Go to Extensions > Plugin Manager.
  • Search for JPrCron.
  • Enable the JPrCron plugin.
tutuploadsmedia_1339955365401.png

Step 2: Configure the plugin

  • Go to Components > JPrc Cron to access the controls.
tutuploadsmedia_1339955580682.png

Step 3: Create Categories

  • Click the Categories tab.
  • Click New.
tutuploadsmedia_1340050374879.png
  • You will see that adding categories is exactly the same process as adding any other category to Joomla.
  • Save and Close. You'll be returned to the main page.
  • Click the Tasks tab.
  • Click New.
tutuploadsmedia_1340050429359.png

Step 4. Define the cronjob

  • Task name: Give the cron job a name.
  • Category: Choose a category.
  • Task type: Choose the task type.
  • Command to Run. Enter the command. This will come from your extension's documentation. In this case I want to update JomSocial, so the command I entered is http://www.domain.com/index.php?option=com_community&;;task=cron
tutuploadsmedia_1340051038202.png

Step 5: Schedule your task

The easiest part to understand here is the scheduler so we'll describe that first:

  • The scheduler is just what it looks like: a menu for choosing the time that the action should start and how often it should be repeated.
tutuploadscronsetupscreenshot.png
  • Unix Crontbab: As you set the schedule, the UNIX Crontab will fill itself in. Each asterisk represents a time definition. The default is for every minute, every hour of every day and that schedule will be represented here by a line of 5asterisks - * * * * *. Each time you make a change in scheduler, the time will be written in the appropriate place, so you won't have to figure out what to put here.
  • Status: published means it's set to run as soon as you're done.
  • Enable logs: If logs are enabled you will get a line written to your log file every single time the cron runs. That could eat up a lot of file space if you have several jobs running every minute. So you would normally set this to No. Change this to Yes only if are trying to troubleshoot the cronjob.
 
tutuploadsmedia_1340051258178.png

After visiting the test site, here is an example of the log message that you can read in the admin panel when logging is set to yes.

tutuploadsmedia_1340055800606.png

Comments

 
kiki90
#1 kiki90 2012-08-20 10:04

What if I want to run this on localhost ?
 

Add comment


Security code
Refresh

blog-ad

Start Online Training

Members get access to all our video training. That's 1,141 training sessions in Joomla, Drupal, WordPress and Coding.

Manage All Your Joomla Sites

adminicredible

With Admincredible you can update and manage all your Joomla sites. If you have 5 or 500 sites, Admincredible will make your life easier! Visit Admincredible.com.

Latest Comments

The License for Our Tutorials

All of our tutorials are published under the Creative Commons Attribution-NonCommercial license. This means:

  • You can re-use these tutorials.
  • You can modify these tutorials.
  • You must link back to our original tutorial.
  • You can't use these tutorials commercially.

Click here to read the full license.

Open Source Training is not affiliated with or endorsed by the Joomla, WordPress or Drupal projects.
All product names and trademarks are the property of their respective owners.

Copyright 2013 Open Source Training, LLC. All rights reserved.