大家好,谁能告诉我如何替换文件路径。我的工匠在projects.algoafrica.co.zw/private/artisan中。我如何才能运行以下命令,我正在从子域中运行Laravel项目,并且我想启用queue:work命令。
以下是给出上述URL到PHP artisan文件的代码,我将需要帮助。这是我要在cron工作中运行的代码行
flock -xn /tmp/laravel_queues.lockfile -c“ / usr / bin / php / path / to / laravel / artisan queue:listen”
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
$path = base_path();
$schedule->call(function () use ($path) {
if (file_exists($path . '/queue.pid')) {
$pid = file_get_contents($path . '/queue.pid');
$result = exec("ps -p $pid --no-heading | awk '{print $1}'");
$run = $result == '' ? true : false;
} else {
$run = true;
}
if ($run) {
$command = '/usr/bin/php -c ' . $path . '/php.ini ' . $path . '/artisan queue:listen --tries=3 > /dev/null & echo $!';
$number = exec($command);
file_put_contents($path . '/queue.pid', $number);
}
})->name('monitor_queue_listener')->everyFiveMinutes();
}