Lost password?    Lost username?    Create an account
OverviewDownloadsForumSupport
CSV Improved

CSV Improved

Setting up a cron job

Requirements: CSVI 4+

Cron command requirements

The cron command is a combination of a few settings:

  1. The PHP executable
  2. The path to cron.php
  3. The arguments

Let's take a closer look at these requirements.

PHP executable

The PHP executable is the program that processes the cron script. How the PHP executable is called completely depends on your host, check with them where your PHP executable resides. Some examples of the PHP executable are:

  • php
  • /usr/local/bin/php

Path to the cron.php file

The file that starts the import or export is called cron.php, this file can be called directly from the command line. The file is located in /administrator/components/com_csvi/helpers/cron.php. It is important to know where the file is as you need to use the path to build the cron command. The full path needs to be the complete path to the cron.php file. The full path depends on your host, check with them what your path needs to be. Some examples of the full path are:

  • /home/domain/public_html/administrator/components/com_csvi/helpers/cron.php
  • /www/administrator/components/com_csvi/helpers/cron.php

Arguments

There are several arguments that need to be passed on to make the cron work. These arguments are:

  • username

This must be a known user in the Joomla system that has backend access.

  • passwd

The password belonging to the supplied username.

  • template_name / template_id

The name of the template that needs to be used. This must exactly match the name of the template in the template list. Instead of using the template name, the template ID can also be used.

  • filename
The full path and name of the file to import. This is only used for imports. It is also possible to store the filename in the template by setting the source to load from server and specify the full path to the filename. Some examples of the full path and name are:
  • /home/domain/public_html/example.csv
  • /www/example.csv

Build the cron command

With all the requirements in place we can build the cron command. The command is build up in this order:
PHP executable path to the cron.php arguments
 
Including the arguments the full command for an import can look like this:

/usr/local/bin/php /home/domain/public_html/administrator/components/com_csvi/helpers/cron.php username="admin" passwd="admin" template_name="CSVI Product import" filename="/home/domain/public_html/example.csv"
/usr/local/bin/php /home/domain/public_html/administrator/components/com_csvi/helpers/cron.php username="admin" passwd="admin" template_id="123" filename="/home/domain/public_html/example.csv"

Including the arguments the full command for an export can look like this:

/usr/local/bin/php /home/domain/public_html/administrator/components/com_csvi/helpers/cron.php username="admin" passwd="admin" template_name="CSVI Product export"
/usr/local/bin/php /home/domain/public_html/administrator/components/com_csvi/helpers/cron.php username="admin" passwd="admin" template_name="124"

Including the arguments the full command for a maintenance task can look like this:

/usr/local/bin/php /home/domain/public_html/administrator/components/com_csvi/helpers/cron.php username="admin" passwd="admin" task="maintenance" operation="emptydatabase"

Make sure this command is all on one line. In a cronjob you cannot span an entry across multiple lines. 

Cron generator

CSVI cron 48

CSVI includes a cron generator option and this is located on the supported pages in the top right corner. This button creates the cron command, however you still need to update the command with the correct PHP executable and username/password.

Template settings

All settings from the template will be used when importing or exporting data. It is possible to use specific settings for a specific cron job. To add these specific settings, after loading the template, make the changes to the template and then click on the cron command. You will now get a cron command with all the changed settings. The command can look like this:

php "D:\server\www\csvi4pro/administrator/components/com_csvi/helpers/cron.php" username="" passwd="" template_id="119" jform:general:category_separator="/"

Setting up the cron command

How to setup the cron command depends on your host. Check with them how to set it up for your site. There are 2 control panel systems used often, these are cPanel and DirectAdmin, instructions for these follow here.

cPanel

  1. Login to cPanel for your site
  2. Click on Cron Jobs in the Advanced area.
    cPanel advanced cron
  3. Select the time you want the job to run in the Add New Cron Job
  4. Fill in your cron command in the Command box
    cPanel cron setting
  5. Click on Add New Cron Job
  6. The job is now scheduled

DirectAdmin

  1. Login to DirectAdmin for your site
  2. Click on Cronjobs in the Advanced Features area
    directadmin advanced cron
  3. Fill in the time you want the job to run in the Create a New Cron Job
  4. Fill in your cron command in the Command box
    directadmin cron setting
  5. Click on Add
  6. The job is now scheduled

EasyCron

If your host does not allow you to run cron jobs, there is an alternative service called EasyCron. EasyCron give you the ability to run cron jobs whenever you like and customize them to your own needs.

The output

The output has been optimized for command line output, this means there is no HTML code. This can be forwarded (piped) to a file for later analyzes.

TESTIMONIAL

One of the my best purchase
5 stars
2012-10-17
CSVI Pro will make your life easier, especially when you work with a lot of product management. It saves time as well as product management now can be manage offline in Spreadsheet program like Excel

The support even better, i purchase several commercial extension and csvi pro is the top leader in support service. Every problem post will have feedback within 1-5 hours, Roland explain a lot of detail clearly, he know what he did.

Hopefully this excellence support and product continues. I recommend this extension to all Virtuemart Developer. A must have !

STAY INFORMED


Stay informed with the CSVI newsletter.