0

We have 16 Linux RHEL 7.5 servers in a cluster and servers are sync with crony service to NTP server

We have two questions

  1. How to know if DST is configured on our servers?

  2. How to disable the DST on our Redhat Enterprise Linux 7 servers?

Paul Gear
  • 4,367
  • 19
  • 38
King David
  • 549
  • 6
  • 20
  • Exact same question asked here: https://unix.stackexchange.com/questions/594088/redhat-enterprise-linux-7-how-to-disable-dst-daylight-saving two hous ago by user `yael` – fpmurphy Jun 20 '20 at 23:50

1 Answers1

6

You don't disable DST per se, you set the desired time zone, and you get DST if the time zone has DST.

You can check the configured time zone with timedatectl.

If your timezone has DST you'll see something like this:

[root@stonard ~]# timedatectl 
      Local time: Sat 2020-06-20 18:27:30 EDT
  Universal time: Sat 2020-06-20 22:27:30 UTC
        RTC time: Sat 2020-06-20 22:27:30
       Time zone: America/New_York (EDT, -0400)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2020-03-08 01:59:59 EST
                  Sun 2020-03-08 03:00:00 EDT
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2020-11-01 01:59:59 EDT
                  Sun 2020-11-01 01:00:00 EST

Otherwise you'll see something like this:

[root@farshire ~]# timedatectl 
      Local time: Sat 2020-06-20 22:26:50 GMT
  Universal time: Sat 2020-06-20 22:26:50 UTC
        RTC time: Sat 2020-06-20 22:26:50
       Time zone: Etc/GMT (GMT, +0000)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

To change the time zone, use timedatectl set-timezone ZONE, where ZONE is a valid zoneinfo zone. For example:

# timedatectl set-timezone Europe/Kiev
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • another note please - lets say if DST ( Daylight Saving Time ) is configured ( and GMT-2 ) then how Linux rhel server know when date will change in the summer? , – King David Jun 20 '20 at 22:33
  • 3
    @KingDavid That information is provided by the relevant national governments to the zoneinfo maintainers. They then update the zoneinfo database, and you receive an update to the `tzdata` package which you can update with `yum`. – Michael Hampton Jun 20 '20 at 22:34
  • @ Michael Hampton - do you means that all info is in TZdata rpm ? – King David Jun 20 '20 at 22:35
  • Yes, the `tzdata` package. You can read about this package at its [official website](https://www.iana.org/time-zones). – Michael Hampton Jun 20 '20 at 22:36
  • but this pkgs was update before 3 years in our servers, and lets say the government decided before 1 year to disable the Daylight Saving , so in this case time will change in the summer while this is wrong - am I correct ? – King David Jun 20 '20 at 22:37
  • 2
    @KingDavid If you did not update the `tzdata` package, then you might have wrong dates for daylight saving. – Michael Hampton Jun 20 '20 at 22:37
  • so based on your comments - then we should disable the DST to avoid problems like this - am I correct ? – King David Jun 20 '20 at 22:38
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/109630/discussion-between-king-david-and-michael-hampton). – King David Jun 20 '20 at 22:40
  • 3
    @KingDavid No, you should keep the `tzdata` package up to date. – Michael Hampton Jun 20 '20 at 22:44
  • can you please described the reasons - in which cases we need to configured DST? – King David Jun 20 '20 at 22:44
  • 2
    You use DST when you need to work with times in a local time zone. If you have no need of this, just use UTC. – Michael Hampton Jun 20 '20 at 22:45
  • I want to give you more details about our cluster with rhel machines servers , ( we have cluster with rhel 7.5 ) in some country in Asia , this cluster is sync with NTP server that located on WIN machine , this cluster is without INTERNET access , so no access from internet to the cluster , in this case I dont see any benefit to set it as DST , do you agree with me ? – King David Jun 20 '20 at 22:50
  • 1
    @KingDavid You don't work with local times on those servers? – Michael Hampton Jun 20 '20 at 23:04
  • I dont think so , ( hope that understand about local time ) , second all server have crony service , and in /etc/chrony.conf we configured the NTP servers , and the last thing is that we cant update the TZdata pkg evry year so we stay with old TZdata – King David Jun 20 '20 at 23:10
  • 3
    If your application doesn't require the timezone to be set to local time, then you can just use UTC like most servers, and forget about DST. If your application does require the timezone to be set to local time, then you should make arrangements to update `tzdata` whenever an update affecting your time zone(s) appears. – Michael Hampton Jun 20 '20 at 23:15
  • ok , can you give example in your question how to move from DST to UTC? – King David Jun 20 '20 at 23:17
  • @KingDavid It already has the example! Just use `UTC` as the timezone you want. – Michael Hampton Jun 20 '20 at 23:24