i'm trying to run lumen scheduler and i have used crontab for this purpose and setup a command like this
* * * * * cd /home/humzayun/fbapp && ea-php71 artisan schedule:run >> /dev/null 2>&1
before this i tried using
* * * * * cd /home/humzayun/fbapp && php artisan schedule:run >> /dev/null 2>&1
but in log file it was throwing errors
[2018-11-13 16:31:03] staging.ERROR: ErrorException: Undefined index: argv in /home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php:53 Stack trace:
0 /home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php(53):
Laravel\Lumen\Application->Laravel\Lumen\Concerns{closure}(8, 'Undefined index...', '/home/humzayun/...', 53, Array)
1 /home/humzayun/fbapp/artisan(34): Symfony\Component\Console\Input\ArgvInput->__construct()
2 {main} {"exception":"[object] (ErrorException(code: 0): Undefined index: argv at
/home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php:53) [stacktrace]
0 /home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php(53):
Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}(8, 'Undefined index...', '/home/humzayun/...', 53, Array)
1 /home/humzayun/fbapp/artisan(34): Symfony\Component\Console\Input\ArgvInput->__construct()
2 {main} "}
So after trying this all finally now my crontab is doing nothing.
my code in Kernel.php is
<?php
namespace App\Console;
use Facebook\Facebook;
use Illuminate\Console\Scheduling\Schedule;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
use PharIo\Manifest\Email;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->call(function (Facebook $facebook){
\Log::info($facebook->getDefaultAccessToken());
echo " yayy here ";
})->everyMinute();
}
}
Now the issue is that log is reporting nothing.
but when i run this command using ssh it output http://prntscr.com/lhxxjq
and my lumen log file shows
But by this cron command nothing is working out like i'm doing in ssh. Any help will be regraded i shall be very thankful to you for help