Can't Add Cron Task In Laravel 5.0.5 On Linux Server

- 1 answer

I am using laravel 5.0.5 and I trying to run cron task on linux server. I can manually run commands by ssh but I can't add command to cron task.

For example:

php artisan test_cron works correctly (insert record to DB) but

php artisan test_cron returns an error:

-bash: app: nie znaleziono polecenia (in English: command not found)


php artisan schedule:run - runs all commands once but

php artisan schedule:run 1>> /dev/null 2>&1 is not working



To add Laravel's scheduling command, firstly open up your crontab as follows:

crontab -e

Then add the following line changing the artisan path to where you have placed your site:

* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1

Then hit save and you should have a message from the crontab:

crontab: installing new crontab

You should then confirm this by scheduling a task in Laravel to send you an email every 5 minutes or something.