Crontab not working ubuntu

I use crontab in ubuntu to send csv to email every day, but not send. Why?

btw, I am using laravel 4.2

UPDATED CRONTAB crontab:

* * * * * /usr/bin/php /var/www/html/.../app/controllers/CronTask.php > /var/www/html/.../public/cronoutput.txt 

The functions for generating csv and sending csv to e-mail are in CronTask.php. I want to view the cron log, so the cronoutput.txt log.

What is the problem?

+6
source share
1 answer

Because I use laravel, so you need to use the larvel artisan command to run crontab on ubuntu. I referred to this site to create a team: https://sonnguyen.ws/laravel-4-and-crontab/

then put all the csv generation and email functions in the fire function. it's done.

Application / Commands / FirstCommand.php

  • php artisan team: make FirstCommand
  • change protected $ name = 'user: active';
  • Add generate csv and email to the fire function. for example: echo "User activated"
  • remove arguments in an array in getArguments function

app / start / artisan.php

  • Artisan :: add (new FirstCommand);

in terminal:

 crontab -e 

command in crontab:

 * * * * * /usr/bin/php /var/www/html/project/artisan user:active >> /var/www/html/project/public/cronoutput.txt 
+4
source

All Articles