D. 777KLM
D. 777KLM

Reputation: 470

Laravel not running Cronjob on Ubuntu NGINX

I have setup the follow Laravel Cronjob command:

protected function schedule(Schedule $schedule)
{
    $schedule->command('DataDownloader:downloaddata')->dailyAt('19:34');
}

This saves some data from an API into a mySQL database. The command is listed under php artisan and I am able to run it using php artisan DataDownloader:downloaddata.

I have added the Cron entry to my crontab as per Laravel documentation:

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

When I run php artisan schedule:run it tells me 'No scheduled commands are ready to run'. I don't really know if this suggests if my Cronjob does not work at all or it is just broken.

Am I missing something or did I do something wrong that prevents the Cron from running?

My server is running Ubuntu with NGINX.

Upvotes: 0

Views: 1803

Answers (1)

crazko
crazko

Reputation: 869

schedule:run command fires other commands that are ready to run at the time of its execution. So it means that in that exact time you ran it, no command was to be started.

However, you have defined cron that runs schedule:run every minute, thus when 19:34 comes, your command will be executed.

Upvotes: 1

Related Questions