Enable cron

01

Cron is a Unix daemon that triggers other programs periodically. It uses crontabs to save information about cron tasks that will be enabled. It is recommended to use it in Linux, but if the same file will be added to the scheduler in Windows, it will also work. In practice, YetiForce can perform certain tasks automatically with cron and trigger them in the background. 

The start of cron can be enabled in a few simple steps: 
  1. Linux system:
    • Add a file to the crontab, e.g. in such format (path-to-crm is the full absolute path to the CRM folder, eg. /var/www/):
      • */5 * * * * sh /path-to-crm/cron/cron.sh > /path-to-crm/cache/logs/cron.log 2>&1 [pay attention to a correct path to the YetiForce system],
      • */5 * * * * php /path-to-crm/cron.php > /path-to-crm/cache/logs/cron.log 2>&1
      • */5 * * * * cd /path-to-crm; /usr/local/bin/php -f cron.php > /path-to-crm/cache/logs/cron.log 2>&1
    • Change file permissions /var/www/crm/cron/cron.sh to 775 [or to other permissions that are compatible with an internal security policy in a company]. 
    • Set a path in the file /var/www/crm/cron/cron.sh to PHP: export USE_PHP=/usr/local/php71/bin/php [here it is also required to pay attention to the file, because it can be located differently on each server and also keep an eye on a path to PHP that is different for various servers. An administrator can provide information about this path or it can be checked in phpinfo]. 
    • Pay attention to the end of line because it should be Unix (LF). If it is Windows on Linux servers, it may cause errors and the system won't be able to run the SH file. 
  2. Windows system - it is not recommended to use Windows as a server for YetiForce.
  3. URL can be used to run cron, e.g. https://gitdeveloper.yetiforce.com/cron.php?app_key=xxxx where app_key is the key that is located in the config/config.inc.php file in the $application_unique_key variable.
  4. If there is a problem with triggering cron from CLI, there is an alternative, but it is not recommended:
    • */5 * * * * /usr/bin/lynx -source https://gitdeveloper.yetiforce.com/cron.php?app_key=xxxx
    • */5 * * * * /usr/bin/wget -O - -q -t 1 https://gitdeveloper.yetiforce.com/cron.php?app_key=xxxx
    • */5 * * * * curl -s https://gitdeveloper.yetiforce.com/cron.php?app_key=xxxx
  • Thursday, 10 August 2017