How to run artisan command in background Ubuntu 17.10

2.3k Views Asked by At

I am trying with putty below command and its working

php artisan horizon

But if I close ssh (putty) this command automatically shut down.

I want to run this command always in the background.

2

There are 2 best solutions below

4
Amin Paydar On

You have some options for run some process in background :

  1. Using & : php artisan horizon &
  2. Using nohup : nohup php artisan horizon (but you don't need this option)
  3. Using systemctl : create a service (but you don't need this option)

in your case the first option is the best.

3
Pubudu Jayawardana On

Try with & at the end of the command to put the process background.

php artisan horizon &