Linux Professional Institute Certification I



Chapter 7 Administering the System


Sommaire

  • Managing Users and Groups
  • Managing Email
  • Using Log and Journal Files
  • Maintaining the System Time


Managing Users and Groups









Managing Email


Using Log and Journal Files






Maintaining the System Time


Understanding Linux Time

  • Hardware clock: The hardware clock that resides on the main card of a computer system
  • Real-time clock: Same as the hardware clock
  • System time: The time that is maintained by the operating system
  • Software clock: Similar to system time
  • Coordinated Universal Time (UTC): A worldwide standard time
  • Daylight saving time: Calculation that is made to change time automatically when DST changes occur
  • Local time: The time that corresponds to the time in the current time zone

As you learned, the current system time is based on a hardware clock. This hardware clock is typically a part of the computer’s motherboard, and it might be unreliable. Because of its potential unreliability, it is a good idea to use time from a more reliable source. Generally speaking, two solutions are available.

One option is to buy a more reliable hardware clock. This may be, for instance, a very accurate atomic clock connected directly to your computer. When such a very reliable clock is used, an increased accuracy of the system time is guaranteed. Using an external hardware clock is a common solution to guarantee that datacenter time is maintained, even if the connection to external networks for time synchronization temporarily is not available.

Another and more common solution is to configure your server to use Network Time Protocol (NTP). NTP is a method of maintaining system time that is provided through NTP servers on the Internet. It is an easy solution to provide an accurate time to servers, because most servers are connected to the Internet anyway.

To determine which Internet NTP server should be used, the concept of stratum is used. The stratum defines the reliability of an NTP time source, and the lower the stratum, the more reliable it is. Typically, Internet time servers are using stratum 1 or 2. When configuring local time servers, you can use a higher stratum number to configure the local time server as a backup, only it will never be used when Internet time is available.

It is good practice, for example, to set stratum 5 on a local time server with a very reliable hardware clock and stratum 8 on a local time server that is not very reliable. A setting of stratum 10 can be used for the local clock on every node that uses NTP time. This enables the server to still have synchronized time when no external connection is available. Stratum 15 is used by clocks that want to indicate they should not be used for time synchronization.

Setting up a server to use NTP time on RHEL 8 is easy if the server is already connected to the Internet. If this is the case, the /etc/chrony.conf file is configured with a standard list of NTP servers on the Internet that should be contacted. The only thing the administrator has to do is switch on NTP, by using timedatectl set-ntp 1.


date Manages local time
hwclock Manages hardware time
timedatectl Developed to manage all aspects of time on RHEL 8

Using date

The date command enables you to manage the system time. You can also use it to show the current time in different formats. Some common usage examples of date are listed here:

• date: Shows the current system time
• date +%d-%m-%y: Shows the current system day of month, month, and year
• date -s 16:03: Sets the current time to 3 minutes past 4 p.m.

Using hwclock

The date command enables you to set and show the current system time. Using the date command will not change the hardware time that is used on your system. To manage hardware time, you can use the hwclock command. The hwclock command has many options, some of which are of particular interest:

• hwclock --systohc: Synchronizes current system time to the hardware clock
• hwclock --hctosys: Synchronizes current hardware time to the system clock

Using timedatectl

A new command that was introduced in RHEL 7 that enables you to manage many aspects of time is timedatectl. As shown in Example 25-1, when used without any arguments, this command shows detailed information about the current time and date. It also displays the time zone your system is in, in addition to information about the use of NTP network time and information about the use of DST.



Eninam BAGNABANA     |         |     bagnadavid@outlook.fr     |