PHP CLI in Cron prüfen
This commit is contained in:
@@ -3,33 +3,29 @@ if (PHP_SAPI != 'cli') exit();
|
|||||||
const PICONTROL = true;
|
const PICONTROL = true;
|
||||||
|
|
||||||
$doNotCheckForAuthentification = true;
|
$doNotCheckForAuthentification = true;
|
||||||
(include_once realpath(dirname(__FILE__)).'/../init.php') or die('Error: 0x0000');
|
(include_once realpath(dirname(__FILE__)) . '/../init.php') or die('Error: 0x0000');
|
||||||
(include_once LIBRARY_PATH.'main/main.function.php') or die('Error: 0x0001');
|
(include_once LIBRARY_PATH . 'main/main.function.php') or die('Error: 0x0001');
|
||||||
|
|
||||||
$folder = CRON_PATH;
|
$folder = CRON_PATH;
|
||||||
$fileArray = array();
|
$fileArray = array();
|
||||||
|
|
||||||
foreach (@scandir($folder) as $file)
|
foreach (@scandir($folder) as $file) {
|
||||||
{
|
if ($file[0] != '.') {
|
||||||
if ($file[0] != '.')
|
if (is_file($folder . '/' . $file) && $file != 'init.php')
|
||||||
{
|
|
||||||
if (is_file($folder.'/'.$file) && $file != 'init.php')
|
|
||||||
$fileArray[] = $file;
|
$fileArray[] = $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($fileArray as $file)
|
foreach ($fileArray as $file) {
|
||||||
{
|
|
||||||
$timeOfFile = str_replace('-', '', substr($file, 0, 2));
|
$timeOfFile = str_replace('-', '', substr($file, 0, 2));
|
||||||
$rest = date('i', time()) % $timeOfFile;
|
$rest = date('i', time()) % $timeOfFile;
|
||||||
|
|
||||||
if (is_numeric($rest) && $rest == 0)
|
if (is_numeric($rest) && $rest == 0) {
|
||||||
{
|
exec('/usr/bin/php -f "' . CRON_PATH . $file . '"');
|
||||||
exec('/usr/bin/php -f "'.CRON_PATH.$file.'"');
|
|
||||||
set_time_limit(30);
|
set_time_limit(30);
|
||||||
usleep(500000);
|
usleep(500000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trim(exec('dpkg -s php7.4-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.3-cli | grep Status: ')) != '' || trim(exec('dpkg -s php8.0-cli | grep Status: ')) != '' || trim(exec('dpkg -s php8.1-cli | grep Status: ')) != '' || trim(exec('dpkg -s php8.2-cli | grep Status: ')) != '')
|
if (trim(exec('dpkg -s php-cli | grep Status: ')) != '')
|
||||||
setConfig('cron:execution.cron', time());
|
setConfig('cron:execution.cron', time());
|
||||||
|
|||||||
Reference in New Issue
Block a user