vendredi 28 octobre 2016

Configure Laravel Task Scheduling with Crontab

I've create a laravel task and added to my crontab file

<?php

namespace App\Console;

use Carbon;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        \App\Console\Commands\Inspire::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $now = Carbon\Carbon::now('America/New_York');
        $dt = Carbon\Carbon::parse($now);
        $time_start = $dt->toTimeString();
        $dt = str_replace('-','_',$dt);
        $dt = str_replace(' ','_',$dt);
        $dt = str_replace('/',':',$dt);
        $schedule->exec('curl '.env('APP_URL').'fbwifi/acl_update')->everyMinute()
            ->sendOutputTo(public_path().'/tasks/log_'.$dt.'.txt');
    }
}


My crontab file

*       *       *       *       *       /usr/local/bin/php artisan schedule:run
*       *       *       *       *       php artisan schedule:run


Result

For some reasons my crontab doesn't trigger. After 5 minutes, I don't anything generated. Am I missing anything ?

How would one go about and debug this ?


I'm opening to any suggestions at this moment.

Any hints / suggestions / helps on this be will be much appreciated !



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire