Home > Enterprise >  How can I run artisan Command to work In background laravel
How can I run artisan Command to work In background laravel

Time:10-12

I want to run the php artisan schedule:work command but the issue is that when i close putty it terminate the operation while i need it to remain processing on server

my server is running Ubuntu 20.4.1 LTS

CodePudding user response:

Actually, the command schedule:work is for local development environment. While you want to run your scheduler on server you should add a cron job like the following:

First, Go to your terminal, ssh into your server, cd into your project and run this command:

crontab -e

This will open the server Crontab file, paste the code below into the file, save and then exit.

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Here we added one Cron job which executes every minute to start the Laravel scheduler.

Don't forget to replace /path-to-your-project with your project path.

CodePudding user response:

Use "nohup php artisan schedule:work"

  • Related