0

I'm running laravel 5.1 and I'm having some issues with the laravel Task Scheduling. The problem is that some of the commands are running, but others aren't. I have no explanation at all for this...

I've got 2 commands as defined like this:

$schedule->command('some:command')
    ->cron('00 00 * * *');

$schedule->command('some:other:command')
    ->cron('50 00 * * 7');

Both of my commands are listed in the protected $commands array.

The some:command command runs fine every day but the some:other:command isn't running at all. When I call the command itself with php artisan everything works fine. It's the same issue when I change the ->cron() function to the ->dailyAt('00:00'); function.

This problem only occurs on my staging environment, on production everything runs fine. Both environments are 100% the same...

2 Answers 2

1

The last digit of a cron schedule should be a value of 0 - 6. 7 is not supported by most crons. If you want to run your cron every sunday, it is best to use 0.

Like so:

$schedule->command('some:other:command')
    ->cron('50 00 * * 0');
Sign up to request clarification or add additional context in comments.

2 Comments

Possibly another date/time setting on your production server.
I changed the value to 0 but the problem is still not fixed. Worked on production, but not on staging
0

Maybe a bit late to the party but hopefully it can help other users:

The problem was that the cron jobs had logging enabled. For some reason the stream to those files was never closed and new runs caused a Permission denied error. This error wasn't logged because logging didn't work...

This also explains why it worked on other environments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.