vendredi 21 octobre 2016

Configure Crobtab to execute Laravel Task Scheduling

I set this on my cron file

*    *    *    *    *    php artisan schedule:run >> /dev/null 2>&1

I have this in my Kenel.php

<?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');
    }
}


If I manually run

php artisan schedule:run

I got

Running scheduled command: curl http://localhost:8888/fbwifi/acl_update > '/Applications/MAMP/htdocs/code/benu/ssc-portal/public/tasks/log_2016_10_21_14:01:33.txt' 2>&1 &

and I see the file to be the log file generated perfectly fine.


Then, I wait another 5 mins, I don't see anything else. I suppose to get 5 more logs generated.


Did I do anything wrong ? How do I check 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