Command Line Script (Cron)The Tracker does lots of work behind the scenes automatically. It prepares the requested reports, archives the reports, removes the old statistical data, renews the visitors geo data, browsers and operating systems data, processes the tracking requests that were logged when Delayed tracking was enabled. We strongly advise to setup the cron script right after you finish the tracker's installation. When a user requests a report in Tracker and decides to add it to the preparation queue – the report will be prepared as soon as the command line script will launch again on the server. That’s why it is preferred to launch the script with smaller intervals. The cron script setting will require your skills of server configuration (or presence of a person who knows how to configure your server). It is not enough just to check the “Enable the cron script” option in the settings. It is also necessary to add a record to the crontab of your server (if it is Linux, FreeBSD or any other Unix-based server) or setup Scheduler in Windows. Setting up Scheduler on Windows might be challenging but without it Tracker will be rather restricted in its capacities. It is necessary to setup the script intervals so that it is launched every minute. It does not mean the script will do something every minute, since it has built-in logic which decides if any new tasks have to be done. But if the script is launched every minute it has the best chance to do all the new tasks in time. In the section “Administration / Cron Settings” you will find the line to be added to the crontab. However, the line may differ a bit for your particular server. In the very beginning of the line there is a 'php' command which tells the server that it is necessary to launch PHP interpreter. It is possible that your server needs to have '/usr/bin/php' or similar command instead. Please consult your system administrator if the default suggested line doesn't work for you The second important setting is “Maximum CPU Load”. Based on this setting Tracker will be taking care of not overloading the server by its operations. And if the load exceeds the specified value, Tracker goes to a sleep mode for a while, until the load is below the critical level again. This works for all processes – Caching, Archiving, Old statistics removal, XML libraries processing. The load limit you specify depends upon your server. We advise you to use the value equal to the total sum of processor cores of your server. That is, if you have Dual Xeon, for example – put “2” in the form field. In the corresponding field you should specify the complete path to GetLoadAvg.exe, so that Tracker could run the program and get the current load information from it. Path example: 'C:Program FilesArkane SystemsLoad AverageGetLoadAvg.exe'. You can also specify the time of day when the cron script should better not be working. It will be launched but will not perform any tasks. PHP CLI
For the command line script to work properly, it should be executed with PHP working in a CLI mode (command line interface). Depending on your version of PHP this might require using a special PHP executable (php-cli.exe, cli/php.exe, etc). Please refer to the documentation on the PHP site for the details related to the version of the PHP installed on your server (the location of the PHP CLI executable differs in different versions of PHP as well as on different platforms): http://php.net/manual/en/features.commandline.php Alternatively, you can ask your hosting company about the exact location of the PHP CLI executable on your server. You can check if the php executable that you are currently using is a CLI version by running it with a “-v” parameter like this:
or like this:
The output should look similar to this:
If you will see “cli” in the brackets immediately after the PHP’s version then you are running a CLI executable – just what you need! If, however, you don’t see “cli” in the output then you are running a wrong PHP executable and you need to find its CLI version. The main advantages of PHP CLI:
LogsThe cron script logs its operations. There are three types of logs available to you:
In each of the three you will find useful information about Tracker operations in a background mode, how long they took and what the server load was. Cron Processes MonitorStarting from version 3.0.1 there is a special tool available to you that monitors background processes. The list of processes includes all the cron script runs no matter if it performed tasks or not. There is a button “Complete” next to uncompleted processes. By pressing it you’ll force the process to finish. If the process is really running, indeed, it will stop as soon as it completes the current operation. If the process has already finished (probably with an error which caused the process to be still marked as uncompleted in the log) then within five minutes such process will be marked as complete automatically. |
|
|
|
Copyright © Stuffed Guys — XXI century