In the chat, a message saying Linux users sent a sudden power failure, the data is not saved, then how in the enterprise to ensure that all data stored on the hard disk of it? This makes me think of the difference between this and the windows, when you want to shut down the server, if someone connects to the server to access data windows, windows will prompt someone to connect to the current server, we notify the user do to facilitate preservation of data preparation, so Linux is not so smart, and to our own artificial prompting the user.
Linux on the shutdown procedures, most of the users that will use the shutdown -h now everything will be fine, in fact, Linux shutdown is also a place worth noting that, let's talk about the shutdown process to do some work to do it !
1. Check the current online staff, who can use this command, you can know who is using Linux resources, this is generally referred to as remote login (Telnet or SSH) to operate the Linux host.
2. See who's connected to the host computer, you can use the netstat command, use the method is generally:
1 netstat -a displays all of the services provided by the state of the machine, behind the display appeared, LISTEN said it is listening service.
2 netstat -an on the basis of the above you can see which port is in use.
3. synchronous data to the hard disk. Under normal circumstances, Linux will be 30 seconds to perform a sync command to write data to the hard disk memory.
Since the Linux system, in order to speed up the read speed of data, in some cases, some data is not directly written to the hard disk, but is temporarily stored in the first memory of them, if the data is repeatedly calls or rewritten, Since then it has not been written to disk is read directly from the memory of them out on a fairly fast, if the data is not stored in the case, restart or shutdown or a sudden power failure, the consequences can be imagined. So you need to restart or shut down when the sync command to write data synchronization input sync, in memory of the data has not been saved, it will be written to the hard disk, instead of the original version, so that the system shut down or restart before the boot, it is best to execute the command, the general command to execute it several times, it is generally preferred to enter the third sync command.
4. Finally, execute the appropriate commands to perform the corresponding action.
Shutdown command: shutdown
Direct Power Off: halt
Note: shutdown can also transmit a warning message to the user login: # shutdown +5 "System will shutdown after 5 minutes" on notice that five minutes after shutdown.