1

I have setup a command to run every Saturday at midnight but it is not working I write this but not running

$schedule->command('weeklyRewardPoints')->weeklyOn(6, '00:00')->timezone('Asia/Dubai');

then I try this but again not working

$schedule->command('weeklyRewardPoints')->weeklyOn(6, '0:0')->timezone('Asia/Dubai');

Even I tried to run at any specific minute at midnight like this but still not working

$schedule->command('weeklyRewardPoints')->weeklyOn(6, '00:30')->timezone('Asia/Dubai');

It is working successfully any other hour and minutes but not at midnight hour and minutes

this is my cron job

* * * * 6     php /home/path-to-my-project/artisan schedule:run >> /dev/null 2>&1
2
  • 2
    the scheduler is supposed to run every minute, which would be * * * * * Commented Feb 2, 2021 at 19:51
  • 1
    @lagbox Thank you so much. It worked! Commented Feb 2, 2021 at 20:10

1 Answer 1

1

Taken from the Laravel docs

So, when using Laravel's scheduler, we only need to add a single cron configuration entry to our server that runs the schedule:run command every minute.

the scheduler need cronjob needs to run every minute

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

your scheduler runs every 6 minutes.

You can furthermore write

$schedule->command('weeklyRewardPoints')->weeklyOn(6)->timezone('Asia/Dubai');

and remove the time from weeklyOn as it is predefined with 0:0.

Sign up to request clarification or add additional context in comments.

1 Comment

thank you for telling me this. I did not know that we have to run cron every minute on server

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.