Setting up scheduled tasks

Some parts of KBPublisher simply will not work if you do not schedule tasks. This includes:

How do I schedule tasks?

You can configure scheduling through the Unix crontab command, through scheduled tasks in Windows, or through  the Control Panel provided by your service provider.

When scheduling tasks for KBPublisher there are several files you must run periodically. 

The files to be scheduled are:

1. By 'crontab' on Unix

# every 5 minutes
*/5 * * * *   /usr/local/bin/php [KBP_DIRECTORY]/admin/cron/freq.php

# hourly
0 * * * *    /usr/local/bin/php [KBP_DIRECTORY]/admin/cron/hourly.php

# daily, after midnight
01 0 * * *    /usr/local/bin/php [KBP_DIRECTORY]/admin/cron/daily.php

# weekly
10 0 * * 0   /usr/local/bin/php [KBP_DIRECTORY]/admin/cron/weekly.php

# monthly
20 0 1 * *   /usr/local/bin/php [KBP_DIRECTORY]/admin/cron/monthly.php

where /usr/local/bin/php is the path to the PHP interpreter, it could differ on your system (you can get it by running 'which php' on command shell), and [KBP_DIRECTORY] is the absolute path to your KBPublisher installation directory (e.g. '/home/user_name/www/kb'). Replace it with your value.

OR

# every 5 minutes
*/5 * * * *   /usr/bin/curl -s http://example.com/kb/admin/cron/freq.php

# hourly
0 * * * *    /usr/bin/curl -s http://example.com/kb/admin/cron/hourly.php

# daily, after midnight
01 0 * * *    /usr/bin/curl -s http://example.com/kb/admin/cron/daily.php

# weekly
10 0 * * 0   /usr/bin/curl -s http://example.com/kb/admin/cron/weekly.php

# monthly
20 0 1 * *   /usr/bin/curl -s http://example.com/kb/admin/cron/monthly.php


You can insert these crontab records by executing 'crontab -e' and editing cron jobs manually, or you can create a file (kbp_cron.txt) containing these lines and execute 'crontab kbp_cron.txt' from shell (WARNING: all existing records in crontab will be removed!).

2. By 'Scheduled Tasks' on Windows

Instead of cron on Windows you can use Scheduled Tasks. Contact your system administrator or hosting provider for additional details.
To set up Scheduled Tasks on Windows XP, Vista and 7, as well as Windows 2003 Server and later, you can use schtasks.exe. Open command line and type in following commands:
 
schtasks /create /ru "System" /sc minute /mo 5 /st 00:00:00 /tn "KBPublisher freq task" /tr "[PHP_DIR]\php.exe [KBP_DIRECTORY]\admin\cron\freq.php"

schtasks /create /ru "System" /sc hourly /st 00:00:00 /tn "KBPublisher hourly task" /tr "[PHP_DIR]\php.exe [KBP_DIRECTORY]\admin\cron\hourly.php"

schtasks /create /ru "System" /sc daily /st 00:01:00 /tn "KBPublisher daily task" /tr "[PHP_DIR]\php.exe [KBP_DIRECTORY]\admin\cron\daily.php"

schtasks /create /ru "System" /sc weekly /st 00:10:00 /d SUN /tn "KBPublisher weekly task" /tr "[PHP_DIR]\php.exe [KBP_DIRECTORY]\admin\cron\weekly.php"

schtasks /create /ru "System" /sc monthly /st 00:20:00 /tn "KBPublisher monthly task" /tr "[PHP_DIR]\php.exe [KBP_DIRECTORY]\admin\cron\monthly.php"

Where: [PHP_DIR] - full path to php.exe, [KBP_DIRECTORY] - full path to KBPublisher directory. Replace it with your values

Example: schtasks /create /ru "System" /sc minute /mo 5 /st 00:00:00 /tn "KBPublisher freq task" /tr "C:\php\php.exe C:\www\kbpublisher\admin\cron\freq.php"

3. By Control Panel

This depends very much on your hosting provider. You should consult their documentation.


Notes:

----------------------------------------------------------------------
This functionality works in version 3.5 and above



Article ID: 238
Last updated: 16 Oct, 2018
Revision: 11
User Manual v7.0 -> Installation -> Setting up scheduled tasks
https://www.kbpublisher.com/kb/setting-up-scheduled-tasks_238.html