I am setting cron job first time in Laravel 5.2. As per their docs, I have modified my app/Console/Kernel.php
as -
protected $commands = [
\App\Console\Commands\Inspire::class,
];
protected function schedule(Schedule $schedule)
{
$schedule->call(function() {
$myfile = fopen("testfile.txt", "w");
}
)->everyMinute();
}
And start scheduler -
* * * * * php /var/www/html/{project_dir}/artisan schedule:run 1>> /dev/null 2>&1
I want to run this cron every minute. But it is totally not working.
If I tried with php artisan schedule:run
cron runs and "testfile.txt" generated in root folder. But why it is not calling automatically every minute? I don't know what's going wrong here.
Any help is appreciated.
Thanks.