I am trying to setup a Cron job which will run after every minute and perform some task. I am using Laravel 5.5 and my site is hosted on Godaddy with shared hosting plan. First I have implemented schedule method in app/Console/Kernel.php file like below:
protected function schedule(Schedule $schedule)
{
$schedule->call(function () {
$video = new Video;
$video->title = 'sample title';
$video->save();
})->everyMinute();
}
Then I have created a Cron Job in relevant section from Godaddy cPanel section. This section looks like below:
I have also setup to send me email every time this tasks runs but nothing is happening. No email, no new entry in Videos table. Although other parts of application are configured correctly and working fine. As far as my guess is, there seems to be something wrong with the path to artisan file that is given in php command. I have tried different combinations but no luck.
shell_exec()
is accepted by the server. Just try it out in tinkershell_exec('ls -la')
and see if you get a list of files or an error. – Dimitri Mostrey