Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

9.3 Uninterrupted session service


May 24, 2021 That's what Linux should learn



As you learn about the sshd service, I wonder if you notice that when a session with a remote host is shut down, the commands running on the remote host are interrupted.

If we are using commands to package files, or if we are using a script to install a service program, we must never close a locally opened terminal window or disconnect a network link, or even a fluctuation in network speed can cause a task to be interrupted, at which point we can only re-connect remotely and restart the task. Sometimes, we are performing file packaging operations, but also want to use scripts to install a service program, then because the packaging operation of the output information filled the user's screen interface, but can only open a remote session of the terminal window, a long time, it is inevitable to forget what these open terminal windows are used.

screen is an open source service program that enables remote control of multiple windows, simply designed to address network anomalies or to control multiple remote terminal windows at the same time. Users can also use the screen service program to switch freely across multiple remote sessions at the same time, enabling them to do the following.

Session recovery: Allows sessions to resume at any time, even if the network is interrupted, ensuring that users do not lose control of the remote session.

Multi-window: Each session is run independently, with its own independent input and output terminal window, and the information displayed in the terminal window will be stored separately in isolation so that the previous operation record can still be seen the next time it is used.

Session sharing: When multiple users log on to a remote server at the same time, you can use session sharing to share input and output information between users.

In the RHEL 7 system, the screen service program is not installed by default, so you need to configure the Yum repository to install it. First set the CD/DVD disc option for the virtual machine to Use ISO Mirror Files and select the system image that has been downloaded, as shown in Figure 9-12.

The accompanying software resources can be downloaded here: https://www.linuxprobe.com/tools/

RedHatEnterprise Linux (RHEL) 7.0 - Red Hat Operating System (required):

Produced by Red Hat, an open source software and global service system developer, the most stable and outstanding Linux operating system.

Training course introduction video: https://www.linuxprobe.com/training

9.3 Uninterrupted session service

Figure 9-12 points the virtual machine's disc device to the ISO image

Then, mount the system image from the disc device to the /media/cdrom directory.

root@linuxprobe mkdir -p/media/cdrom(root@linuxprobe) /dev/cdrom/media/cdrom mount: /dev/sr0 is write-protected, mounting read-only finally, use the Vim text editor to create a profile for the Yum repository. The meaning of the specific parameters used in the following commands can be referred to in section 4.1.4.

Now that root@linuxprobe you can install the screen service program using the Yum repository, you can use the Yum repository to install the screen service program. In a concise sense, Ms. Liu will filter the Yum software installation information that appears in the next section - omitting non-essential information that is highly repetitive and meaningless.

[root@linuxprobe ~]# yum install screen Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. Y ou can use subscription-manager to register. r hel | 4.1 kB 00:00 Resolving Dependencies --> Running transaction check ---> Package screen.x86_64 0:4.1.0-0.19.20120314git3c2946.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved

  1. Package Arch Version Repository
  2. Size
  3. ================================================================================
  4. Installing:
  5. screen x86_64 4.1.0-0.19.20120314git3c2946.el7 rhel 551 k
  6. Transaction Summary
  7. ================================================================================
  8. Install 1 Package
  9. Total download size: 551 k
  10. Installed size: 914 k
  11. Is this ok [y/d/N]: y
  12. Downloading packages:
  13. Running transaction check
  14. Running transaction test
  15. Transaction test succeeded
  16. Running transaction
  17. Installing : screen-4.1.0-0.19.20120314git3c2946.el7.x86_64 1/1
  18. Verifying : screen-4.1.0-0.19.20120314git3c2946.el7.x86_64 1/1
  19. Installed:
  20. screen.x86_64 0:4.1.0-0.19.20120314git3c2946.el7
  21. Complete!