Online Chat
 Call Us: 
1-877-744-1221
Browse Submit a Ticket
 
Advanced Search
Tools
Rss Categories

Setup Cron job on Linux/UNIX via command line

Author: Edward Hardin Reference Number: AA-00484 Views: 12200 Last Updated: 01/04/2011 04:20 PM 0 Rating/ Voters

To setup KMP Cron job, edit a crontab file through the command line. To do that, type:

crontab -e

If this fails you need root access. Try:

sudo crontab -e

You need to add the following line to the crontab.

Format:

* * * * * %PATH-TO-PHP% %PATH-TO-KMP%/admin/CRON/cron.php %URL-TO-KMP%

Where:

* * * * * - condition that tells cron to run this job every minute.

Replace %PATH-TO-PHP% with path to PHP executable file. If you don’t know the path to PHP, then you can ask your server admin. Here are some examples of possible paths to PHP:

/usr/bin/php
/usr/local/bin/php

Replace %PATH-TO-KMP% with physical path (not URL) where you have installed KnowledgeBase Manager Pro. If you know the path to your account, then you can simply add the remainder of the path to your actual script e.g. /home/user1/public_html might be the path to your account (document root) and the script might be in kmp/admin/CRON/cron.php resulting in /home/user1/public_html/kmp/admin/CRON/cron.php

Replace %URL-TO-KMP% with URL to location where you have installed KnowledgeBase Manager Pro (if open this URL in your browser, you'll see the front-end part of your knowledge base).

Example:

* * * * * /usr/bin/php /usr/www/kmp/admin/CRON/cron.php http://www.mywebsite.com/kmp/
Warning

Please, do not forget the slash at the end of the last parameter.

This is correct:

http://www.mywebsite.com/kmp/

This is incorrect:

http://www.mywebsite.com/kmp

Open the KMP control panel and go to Administration > General Settings > Auto Related Articles. You may see the following message there previously: "You have to setup cron script in order to use this functionality."


This message will disappear after the first run of the Cron script. Click "Recheck"  in about a minute to see that Cron job has been successfully installed.



Alternative cron command

There is also another way to run KMP cron. You can do this via wget. Use it if the example above doesn't work for you for some reason.

Format:

* * * * * wget -q %URL-TO-KMP%/admin/CRON/cron.php 1>/dev/null 2>&1

Example:

* * * * * wget -q http://www.mywebsite.com/kmp/admin/CRON/cron.php 1>/dev/null 2>&1