UNIX, Linux Class Server maintenance is often done through SSH, and some operations take a long time, such as: Updates, file backup, software compilation and installation. If you disconnect the SSH connection, the update will be interrupted. How can you keep the update process running after you disconnect ssh? There are two ways of doing this:
1, Nohup
#nohup Application Name &
After that, if you disconnect ssh, the program is still running.
If you need to end the process after you run it, you need to kill the way.
2. Screen
Install the screen first through the Yum install-y screen, apt-get install Screen-y .
(1) How to run the required process through screen:
#screen
Then press the SPACEBAR or enter the screen session, you can run the user needs the program.
(2) How to exit screen after running the required process
After running the process required by the user, you can switch back to the main interface before running screen by pressing CTRL + A and then pressing the D key.
After exiting screen, the user can make other operations or disconnect the SSH connection if the process is guaranteed to run normally.
(3) View the currently existing screen session
#screen-ls
The results are as follows:
(4) How to access an existing screen session
#screen-R Session Code
Such as:
Screen-r 8858.pts-0.iz28*****
You can enter the screen session where the user executed the process.
13:41:38
To exit SSH, the program continues to run the workaround