Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cronjob Homestead not working

I've created a command to send automatic emails. When I do homestead ssh and I run php artisan emails.send an email arrives in my mailtrap.io account.

I've added this code to the kernel.php

$schedule->command('emails:send')->everyFiveMinutes();

I've put it at a 5 minute interval, just to make it easier to quickly test it. I've ssh'd into Homestead and performed

php /home/vagrant/Code/soeptime/artisan schedule:run 1>> /dev/null    2>&1

then I exit homestead and I did homestead provision

However, there is nothing in the logs and I still haven't received an email, homestead is now running for more then 15 minutes.

like image 835
Cquence Avatar asked Aug 21 '15 13:08

Cquence


People also ask

Why is Cronjob not working?

Crontab might fail for a variety of reasons: The first reason is that your cron daemon might not be working for any reason, resulting in your crontab failing. There also exists a possibility that your system's environment variables are not settled correctly.

What is the use of * * * * * In cron?

It is a wildcard for every part of the cron schedule expression. So * * * * * means every minute of every hour of every day of every month and every day of the week .

Do Cronjobs run automatically?

The cron reads the crontab (cron tables) for running predefined scripts. By using a specific syntax, you can configure a cron job to schedule scripts or other commands to run automatically.


1 Answers

You need to manually edit crontab:

First:

 crontab -e

and then add

* * * * * php /home/vagrant/Code/soeptime/artisan schedule:run
like image 192
Can Celik Avatar answered Sep 30 '22 13:09

Can Celik