2016-09-23 16 views
0

这是我的内核:Laravel 5.2定时任务不起作用自动

protected $commands = [ 
    Commands\AdvertiseTasks::class, 
]; 

protected function schedule(Schedule $schedule) 
{ 
    $schedule->command('advertise:delete')->everyMinute(); 
} 

这就是我的命令处理

public function handle() 
{ 
    Advertise::where('expired', '<=', Carbon::now()->createFromTime(23, 59, 59))->delete(); 
    $this->info('All Expired Advertise Are Deleted Successfully!' . Carbon::now()); 
    Log::info('All Expired Advertise Are Deleted Successfully!'); 
} 

,我对我的项目运行此命令:

cd /wamp/www/project 
php artisan schedule:run 

我看着我的日志,当我按下输入它确定。日志已更改,但几分钟后日志不会更改,并且Crone不会自动启动。我能怎么做?

+0

什么是您的cron项是什么样子? – Samsquanch

+1

你还没有发布你的cron条目。您必须在crontab中有条目才能运行该命令。就像'* * * * */usr/bin/php/path/to/project/artisan schedule:run>/dev/null 2>&1' - 你有没有设置? – Samsquanch

+0

@Samsquanch对不起我的cronetab命令doest'n工作,我怎么能把这个添加到你说? –

回答