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 334 times
0
-
Please search first, there are several answers to this question. – Paul Nov 26 '14 at 04:27
2 Answers
2
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
- 53,069
- 19
- 162
- 212