0

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 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks first one is working. Can you please guide me about the termination of this command if in future I want to stop this command.
$ ps aux | grep php then you can see the pid of you command and then run $ kill -9 pid
maybe your process is finished.
this command php artisan horizon & working in the background until putty is working but I want this command work always run in the background after I close putty.
3

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

php artisan horizon &

3 Comments

Can you please guide me about the termination of this command if in future I want to stop this command.
You can use fg to get the last background command into the foreground and Ctrl+c to terminate it.
this command php artisan horizon & working in the background until putty is working but I want this command work always run in the background after I close putty.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.