I have the following function:
protected function schedule(Schedule $schedule)
{
$schedule->command('email:users')->everyMinute();
}
when I run the command
artisan schedule:run
it sends an email but when I add the following command to the cpanel as a cron job it doesn't send any email. Cpanel suppose to email me a notification when the cron job is run but I haven't receive a single email.
php /home/rain/artisan schedule:run 1>> /dev/null 2>&1
Where am I doing wrong?
Also when I run the command artisan schedule:run
it runs it only once. I am very curious why do I have to add ->everyMinute();
if it is not going to run every minute? If I want to send it weekly I can setup the cron job. Why do I have to write to add ->weekly();
in the function if cron job is sending it weekly?
php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1
– Unassailable