mardi 27 septembre 2016

Laravel Cron Job not running commands

Good Morning

I am working with Laravel 5.3 , on an Digital Ocean LEMP Stack droplet (ubuntu server).

I am trying to create a cron job that will my command every 15 minutes, It looks like the cronjob on the server is running , but the command is not getting executed.

Now if manually do php artisan import:data from the server terminal, it runs perfectly.

This is in my crontab -e:

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

On the laravel docs it shows this:

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

So im sure this is correct.

Inside of app/console/kernel.php:

protected function commands()
{
    require base_path('routes/console.php');
}

protected $commands = [
    \App\Console\Commands\ImportData::class,
];


protected function schedule(Schedule $schedule)
{
    $schedule->command('import:data')->cron('*15/ * * * * *');
}

Inside my app/console/commands/ImportData.php:

use App\Import;

class ImportData extends Command
{

protected $signature = 'import:data';

protected $description = 'Imports page100.txt probe data';

public function __construct()
{
    parent::__construct();
}

public function handle()
{
    $import = new Import;
    $import->start();
}

I dont understand why this isnt working with cronjob, but it working when i manually run php artisan import:data



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire