How to Setup Cron for uKnowva

For uKnowva versions 2.4.4 and earlier, you can set up cron by following the steps mentioned below.

Setting up Cron for a Newly Installed Instance

If you have newly installed uKnowva and are setting up cron for the first time, then follow these steps:

Create a crontab file by entering the following terminal command: 

crontab -u <user> -e

Entering the above command will open a terminal editor with a new blank crontab file, or it will open an existing crontab if you already have one. You can now enter the commands to be executed, see syntax below, before saving the file and exiting the editor. As long as your entries were entered correctly, your commands should now be executed at the times/dates you specified.

Crontab Syntax

A crontab file has six fields for specifying minute, hour, day of month, month, day of week and the command to be run at that interval. See below:

<Minute> <Hour> <Day_of_the_Month> <Month_of_the_Year> <Day_of_the_Week>  command to be executed

The range of accepted values for the fields are as follows:

  • Minute: 0–59
  • Hour: 0–23
  • Day of the Month: 1–31
  • Month: 1–12
  • Day of week: 0–6 (Sunday = 0)

uKnowva Cron Command

*/15 * * * * curl "http://instance.uknowva.com/index.php?option=com_custom&cmd=handlecron"> /dev/null 2>&1

OR

*/15 * * * * curl "http://IPAddress/index.php?option=com_custom&cmd=handlecron"> /dev/null 2>&1

Once the cron is added you must restart the cron service.

Restarting the Cron Service

]# /etc/init.d/crond restart

Stopping crond: [ OK ]
Starting crond: [ OK ]

Now, your Cron job is setup successfully.

For an Instance Installed 3-4 Months Earlier

If you have already installed uKnowva 3–4 months earlier, then you need to follow the steps outlined below. If you enable cron using the method mentioned above you will receive archived mails of the application from the date of installation. This is a different process.

Login into MySQL and truncate the records of #__community_mailq table

mysql> use database_Name;

 Reading table information for completion of table and column names. You can turn off this feature (use the command -A) to get a quicker startup

mysql>truncate #__community_mailq;

Once the truncate process done, you can setup the cron using same code:

crontab -u -e

and add the below line:

*/15 * * * * curl "http://instance.uknowva.com/index.php?option=com_custom&cmd=handlecron"> /dev/null 2>&1

Now close the cron and Restart the cron service:

# /etc/init.d/crond restart

Stopping crond: [ OK ]
Starting crond: [ OK ]

Now, Cron job is setup successfully.

 

For uKnowva 2.5.1 onwards, you can simply use this cron URL:

http://instance.uknowva.com/index.php?option=com_custom&cmd=cron

So a cron tab command for Linux-based systems would be:

*/15 * * * * curl "http://instance.uknowva.com/index.php?option=com_custom&cmd=cron"> /dev/null 2>&1
{jcomments on}