Reason: When logging in to Linux, the system will assign a session to the logged-in user. All programs running in this terminal, including foreground process group and background process group, generally belong to this session. When the user logs out of Linux, the system will send SIGHUP signals to all processes associated with the session, and the foreground process group and background process output to the terminal will receive SIGHUP signals. The default operation of this signal is to terminate the process, so the process group in the foreground and the process with terminal output in the background will be terminated.
Solution:
Method 1: Use the screen
Screen tool is a terminal multiplexer, which essentially means that we can run multi-terminal applications using a single terminal window.
Introduction to screen commands
1.$:screen creates a screen.
2.$:screen -ls displays all screen sessions.
3.$:screen -d leaves the current screen and returns to the normal shell.
4.$:screen -r 636 1 (author's note: huihuaID, available from session -ls) enters the specified screen.