Search code examples
laravellaravel-5cronzshubuntu-18.04

Why i can't add Cron entry to my ubuntu 18.04 server?


Created laravel artisan Command to execute inside Laravel 5.5 Scheduler (every month).

When i add Cron entry to my ubuntu 18.04 server with crontab -e :

* * * * * php /var/www/html_public/project-name/artisan schedule:run >> /dev/null 2>&1

command on terminal

Note:

$ php artisan schedule:run 

Work just fine

Documentation used


Solution

  • Try to write your cron in the other way:

    * * * * * cd /var/www/public_html/laravel-project-name && php artisan schedule:run >> /dev/null 2>&1