12
votes

Trying to Scheduling Artisan Commands

https://laravel.com/docs/5.0/artisan

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

Can someone please show me how do I know the /path/to/artisan ?

4

4 Answers

17
votes

artisan is in your Laravel project root. So, if your project path looks like /home/laravel-proj/ use this:

* * * * * php /home/laravel-proj/artisan schedule:run 1>> /dev/null 2>&1
4
votes

extending the answer given by @Alexy Mezenin , to get current working directory on ubuntu use pwd command.

For windows user it may be cd

So if you have a project in desktop/blog. go to the blog directory and run pwd command and you'll get the path to artisan which is /home/user/Desktop/blog

Then you'll use this:

* * * * * php /home/user/Desktop/blog/artisan schedule:run 1>> /dev/null 2>&1
2
votes

Artisan is located in your project directory. For instance, my crontab shows something like this:

 *  *  *  *  *  /usr/bin/php /var/www/projectfolder/artisan command
-1
votes

On linux systems: Using terminal > Go to project folder-> run pwd.The path you should get is the absolute path to your project.

On Windows, I think you need to run cd