By umairali110
I am trying with putty below command and its working
php artisan horizon
But if I close ssh (putty) this command automatically shut down. with & command working in the background until I close putty.
php artisan horizon &
I want to run this command always in the background.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
You need to use nohup utility to make it live after logging out.
nohup exec php artisan horizon
To ensure that php artisan horizon runs in the background even after you close your SSH session, you can use one of the following approaches:
nohup (No Hang Up):nohup allows a process to continue running after the SSH session is closed.
nohup php artisan horizon > /dev/null 2>&1 &
This command sends the output to /dev/null, effectively discarding it. You can also redirect it to a file if you want to log the output:
nohup php artisan horizon > horizon.log 2>&1 &
screen:screen allows you to run a process in a session that can be detached and reattached later.
screen (if not already installed):sudo apt-get install screen
screen -S horizon
php artisan horizon
Detach from the session by pressing Ctrl+A, then D. This will keep the process running in the background.
To reattach to the session:
screen -r horizon
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.