嗨,我正和Laravel一起经营CRON JOB
Laravel中的函数声明
protected function schedule(Schedule $schedule)
{
    echo "test CRON JOB\n";
    $file1 = '1.log';
    $file2 = '2.log';
    $schedule->command('command1')->sendOutputTo($file1);
    $schedule->command('command2')->sendOutputTo($file2);
}
CRON JOB - 设定
pathToArtisan schedule:run 2>&1 >> /home/log/cron_output.log
日志文件输出(cron_output.log)
test CRON JOB
Running scheduled command: '/opt/alt/php55/usr/bin/php' 'artisan'command1 > '1.log' 2>&1 &
Running scheduled command: '/opt/alt/php55/usr/bin/php' 'artisan' command2 > '2.log' 2>&1 &
显示功能计划中的回显,但命令1和命令2中的回显不是.
我试过了
echo "test"; $this->info('test');
没有文件1.log或2.log既不创建/ home/log /,也不创建Kernel.php文件或Command文件夹
有任何想法吗 ?
谢谢
avi*_*vip 22
您应该使用Laravel中的内置任务输出方法.
例如:
$file = 'command1_output.log';
$schedule->command('command1')
         ->sendOutputTo($file);
现在一切正常。
$schedule->command('command1')
     ->sendOutputTo($file);
在你的命令中
$this->info('test')
这些文件是在我的应用程序的根文件夹中创建的,所以我没有看到它们!
谢谢
| 归档时间: | 
 | 
| 查看次数: | 11767 次 | 
| 最近记录: |