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

Jak uruchomić cron-a?

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.

    warning

    Ważne jest, aby skrypt był uruchamiany z takimi samymi uprawnieniami jak właściciel plików systemowych.

*/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

Adres URL może być używany do uruchomienia CRON, np. https://demo.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://demo.yetiforce.com/cron.php?app_key=xxxx
*/2 * * * * /usr/bin/wget -O - -q -t 1 https://demo.yetiforce.com/cron.php?app_key=xxxx
*/2 * * * * curl -s https://demo.yetiforce.com/cron.php?app_key=xxxx