Cronjob Feature
Starting with LEPTON 7.0.0 core got a cronjob class to ease the execution of internal and external cronjobs.
With the installation of (or upgrade to) LEPTON 7.0.0 you got some additional files:
- class lepton_cronjob in /framework/classes
- cronjob.php in modules directory
- cronjob_ini.php in config directory
- cj_example.php file in /temp/secure
but you ou only have to care about the last 2 files.
You also got a new entry in your lepton.ini.php that enables internal cronjobs for frontend and/or backend:
CRONJOB = 0 ; 0 = disabled, 1 = FE only, 2 = BE only, 3 = BE + FE
Handle files: cronjob.ini.php
The file cronjob.ini.php holds all neccessary values (similar to lepton.ini.php) and you have to edit the values to your needs.
You can also add as much values as you like in the custom area for use in your cronjob file.
The [file_info] values are automatically handled by the class LEPTON_cronjob.
The [custom_values] have to be handled by yourself, see example below.
Handle files: cj_example.php
In this file you can put all your devices and code for your cronjob. Please try the following code for a first test
Working with those cronjobs is different.
1. external cronjobs
If you want to run your cronjob please simply call the url
https://your_domain.tld/modules/cronjob.php?key=your_key_from_cronjob_ini_file
in your browser or use this url for calls by a service provider (something like cronjob.de).
Thats it.
Please take care that you don't get unwanted cronjob calls by checking some values (see example code above).
2. internal cronjobs
If you want to run your cronjob every time the backend or frontend of your installation is called you have to switch the value CRONJOB in your lepton.ini.php to 3.
This ensures the cronjob is called depending on the value in your lepton.ini.php.
Support
If you got further questions or you run into troubles please use the LEPTON forum.