Hallo,
ich wäre sehr froh, wenn mir jemand helfen könnte, denn ich finde die Ursache nicht, warum ich diese Fehlermeldung bekomme obwohl der Pfad stimmt und das Script auch kurz läuft
Was mir diese Meldung sagt:
Script with PID $pid is still running.
Aber dann wird der Vorgang abgebrochen und ich erhalte diese Meldung:
Script with PID $pid is not running.
Meine Logdatei gibt dann diese Fehlermeldung an:
nohup: failed to run command '/usr/bin/php8.2-cli': No such file or directory
Anscheinend kann ich nicht aus Joomla die gewünschte php-Datei erreichen und mein Script darin starten, obwohl das Script angeblich startet.
Hier das Script:
----------------------------------------------------------------
Code
use Joomla\CMS\Uri\Uri;
use MTB\Core\Names\CfProperties;
use MTB\Process;
$path = $_SERVER['DOCUMENT_ROOT'];
if (!defined('DS'))
{
define('DS', DIRECTORY_SEPARATOR );
}
$parmId = $this->data(CfProperties::ParmId, '');
$importType = $this->data(CfProperties::ImportType, '');
$scriptToExecute = $path.DS.'cronJobs'.DS.'importTest.php';
$log = $path.DS.'cronLog'.DS.$parmId.'.log';
$scriptParameters = sprintf(
'--parmId "%1$s" --type "%2$s" --user %3$d -l %4$d',
$parmId,
$importType,
911,
1000);
echo "<pre>";
print("$log\n");
$p = new Process("php8.2-cli $scriptToExecute $scriptParameters", $log);
$p->stop();
$p->start();
$pid = $p->getPid();
print("Script '$scriptToExecute' has been started with PID: $pid and parameters: $scriptParameters \n");
if ($p->status()) {
$this->data('pidRunning', 1, true);
print("Script with PID $pid is still running.\n");
} else {
$this->data('pidRunning', 0, true);
print("Script with PID $pid is not running.\n");
}
echo "</pre>";
$this->data('pid', $pid, true);
return $pid;
Alles anzeigen