I am sshing to my remote CentOS 5 server and want to run a script that takes long time. How can I have it keep running even after I close ssh session?
Asked
Active
Viewed 505 times
2 Answers
3
You can use nohup in conjunction with & like this:
nohup ./m_script.sh &
The magic of nohup is that it allows a process to run even if your connection to the machine is gone. Meaning you logged out or are even disconnected. The & at the end means the process should run as a background process.
So when you enter that command the combo of nohup and & assures you that after you logout the process will still be running on the server.
Giacomo1968
- 58,727