Cron Job Laravel 4

cron, laravel-4

Solution

`liebig/cron` comes with `'preventOverlapping' => true` enabled in its config file. This prevents cron job from running again, when it is already running (i.e. previous cycle not finished yet).

To do this `cron` package create file named `cron.lock` in `app/storage` folder. Sometimes due to file permission issues, this file does not get deleted even after successful cron job completion, thus preventing any future cron job runs.

Check the file permissions in app/storage directory. If `cron.lock` exists delete it and let the cron job run again.

Hope this helps you.

Problem

I am using the liebig/cron package for cron job in my project, I followed the installation process of this package properly, And here is my code ``` Route::get('/cron/run/cronjob123', function () { Cron::add('example1', '* * * * *', function() { echo 'success'; die; return null; }); $report = Cron::run(); }); ``` Right now i am working in localhost so when i enter the url myproject/cron/run/cronjob123 It should display success But directly the execution flow is going to $report And the the $report has this result, ``` Array ( [rundate] => 1398489241 [runtime] => -1 ) ``` I am not getting where i am going wrong.

Original source