Gary
Gary

Reputation: 13

Can't add cron task in Laravel 5.0.5 on linux server

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)

and

php artisan schedule:run - runs all commands once but

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

Upvotes: 1

Views: 468

Answers (1)

Jamesking56
Jamesking56

Reputation: 3901

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.

Upvotes: 1

Related Questions