I have the following method in my Kernel.php
(the one under Console
of course):
protected function schedule(Schedule $schedule)
{
$schedule->exec("touch lorem.txt")->everyMinute();
}
And I have the following cronjob added through the cpanel:
* * * * * cd /home/oeit/oe && php artisan schedule:run >> /dev/null 2>&1
I am supposed to see a lorem.txt
file in the disk. However when I search for it using find / -name "lorem.txt"
the file doesn’t appear, which makes me believe that my cronjob is not working properly. I am on a shared hosting.
How do I fix this?
2
Answers
I had to specify the full path for the php executable:
If you’re on shared hosting, it’s entirely possible that it is running, but you don’t have access to use
$schedule->exec
on the server.I would take a look in the
storage/logs/laravel.log
file to see if you are getting any errors.