Skip to main content
Version: 7.x

CRON | Scheduler

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 on Linux, but if the same file will be added to the scheduler on Windows, it will also work. In practice, YetiForce can perform certain tasks automatically with cron and trigger them in the background.

cron

How to enable CRON?

CRON can be enabled in a few simple steps:

Linux - edit /etc/crontab file, /etc/cron.d/yetiforce file, or 'crontab -e':

  • Add an entry to crontab, or a file to CRON, e.g. in such format (__YETIFORCE_PATH__is the full full absolute path to the YetiForce system folder e.g. /var/www/example),

    warning

    It is important that the script is run with the same permissions as the owner of the system files.

*/2 * * * * www-data __YETIFORCE_PATH__/cron/cron.sh > __YETIFORCE_PATH__/cache/logs/cron.log 2>&1
*/2 * * * * www-data sh /var/www/cron/cron.sh > /var/www/cache/logs/cron.log 2>&1
*/2 * * * * sh __YETIFORCE_PATH__/cron/cron.sh > __YETIFORCE_PATH__/cache/logs/cron.log 2>&1
*/2 * * * * php __YETIFORCE_PATH__/cron.php > __YETIFORCE_PATH__/cache/logs/cron.log 2>&1
*/2 * * * * cd __YETIFORCE_PATH__; /usr/local/bin/php -f cron.php > __YETIFORCE_PATH__/cache/logs/cron.log 2>&1
  • Change file permissions __YETIFORCE_PATH__/cron/cron.sh to 744 (or to other permissions that are compatible with an internal security policy in a company).

cron

  • Set a path in the file __YETIFORCE_PATH__/cron/cron.sh do PHP: export USE_PHP=/usr/local/php74/bin/php74 (pay attention to the file, as 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).

    cron

  • 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.

    cron

URL can be used to run CRON, e.g. https://gitdeveloper.yetiforce.com/cron.php?app_key=xxxx

The app_key is the key located in the config/Main.php file in the $application_unique_key variable.

cron

*/2 * * * * /usr/bin/lynx -source https://gitdeveloper.yetiforce.com/cron.php?app_key=xxxx
*/2 * * * * /usr/bin/wget -O - -q -t 1 https://gitdeveloper.yetiforce.com/cron.php?app_key=xxxx
*/2 * * * * curl -s https://gitdeveloper.yetiforce.com/cron.php?app_key=xxxx