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
source share