Get the App
SLTechnology News&Howtos  ›  Development  › 

How to view online users and notify Linux before shutting down

Shulou Source: shulou.com Published: 2022-06-01 15:11:47 10月03日 Update

This article mainly shows you "Linux how to view online users and send notifications before shutting down". The content is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to view online users and send notifications before Linux shuts down".

Step 1: view

As an administrator, the first step is to see who is using the machine, who is using the machine, and what programs the user is executing.

To see who is on this Linux server, the command is who. Execution on the command line returns which users logged in to the server through which terminal and what IP address was used to log in, as shown in the following figure.

To view the programs executed by all users, you can use the ps command with appropriate parameters, and the specific use of the ps command will be explained in detail in later experiments.

Step 2: notification

If you notify other users that the system is going to shut down, you can notify other online users by email or phone before executing the shutdown command, or you can add parameters to prompt the shutdown time on the screen of other users when executing the shutdown command. It is important to give advance notice before shutting down the phone. Companies with different notification methods have corresponding operation and maintenance management systems, which must be implemented in accordance with the requirements, otherwise the consequences will be very serious.

Step 3: turn off the computer

The correct use of the command, in the Linux system, in order to speed up the data reading speed, by default, the data being executed will be temporarily stored in memory, that is, Cache, rather than directly written to the hard disk to save. Because the reading speed of the memory is more than 10 bits faster than that of the hard disk, this running mechanism makes the data read in the cache much faster.

However, this operation mechanism will also bring some problems, that is, once the LinuX system shuts down abnormally due to some special circumstances, such as the abnormal power outage in the computer room or the misoperation of the maintenance personnel, some of the data is stored in the cache and has not been written to the hard disk, resulting in the loss of some data and file damage. This will have a serious impact on the normal operation of the system. So how to avoid this kind of accident in Linux system? There is a sync instruction to write to disk with updated data in the cache. Commands such as shutdown/reboot/halt call the sync command to update data to disk before shutting down, but to be more secure, execute the sync command a few more times before shutdown.

The above is all the contents of the article "how to view online users and notify Linux before shutting down". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Command user data system online memory content situation server hard disk article cache speed service run user parameter method mechanism in Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Apple Microsoft vpn NVidia