• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Disable Daylight Savings Time (DST), and Modify the Timezone on Linux

By admin

Many countries do not follow DST changes, and by default, they are configured so DST time changes alter their system times and even the database times running on them. This post outlines steps to disable DST and modify the timezone on a Linux server.

In this example, the time is set as per Brazil country, with a timezone of GST-3.

OS files involved:

/etc/sysconfig/clock
/etc/localtime

If you look in the directory /usr/share/zoneinfo/Etc on the server, you will see subdirectories by country and even by timezone within the country. You need to identify what directory and subfiles for your target host.

In our example we are on the East coast in Brazil, GST-3:00. There are zoneinfo files which have the difference from DST hard coded:

GMT
GMT0
GMT-0
GMT+0
GMT-1
GMT+1
GMT-2
GMT+2
GMT-3
GMT+3
GMT-4
GMT+4
GMT-5
GMT+5
GMT-6
GMT+6
GMT-7
GMT+7
GMT-8
GMT+8
GMT-9
GMT+9
GMT-10
GMT+10
GMT-11
GMT+11
GMT-12
GMT+12
GMT-13
GMT-14

So, the directory/file for them would be: /usr/share/zoneinfo/Etc/GMT-3

1. Modify the file /etc/sysconfig/clock to read:

# vi /etc/sysconfig/clock
ZONE="Etc/GMT-3"
UTC=true
ARC=false

2. Follow these steps to correctly set the file/link /etc/localtime:

# cd /etc
# rm /etc/localtime
# ln -s /usr/share/zoneinfo/Etc/GMT-3 /etc/localtime
# ls -al localtime
# date

The ‘ls -la localtime’ command above should show the file /etc/localtime as a symbolic link to /usr/share/zoneinfo/Etc/GMT-3. Also ‘date’ command should return the correct time for Brazil East- GST-3:00.

3. For databases- the only thing you have to make sure of is that the DB OS owner does not have any environmental variables of “TZ” set. When your databases start- if they do not see any TZ variables set- they will use the OS time as the DB time.

– Connect as DB user and run:

# env |grep -i TZ

The output of the above command should show nothing set at the OS as “TZ=”. If there is some timezone already set, then you need to modify the Oracle Db user’s profile so this is unset.

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to find the inode size of an ext2/ext3/ext4 filesystem?
  2. CentOS / RHEL 5 : How to Boot into Rescue Mode
  3. How to install rsyslog7 when rsyslog5 is already installed in CentOS/RHEL
  4. “uname” Command Examples to Check UNIX/Linux Version
  5. How to Password Protect GRUB2 in Oracle Enterprise Linux 7
  6. Swapon Fails To Mount Swap – Gives Invalid Argument Error
  7. CentOS / RHEL : Exclusion with Yum For Kernel Updates
  8. CentOS / RHEL 6 : How to disable Transparent Huge pages (THP)
  9. Audit Log And Messages File Not Rotating on CentOS/RHEL
  10. How to identify the HBA cards/ports and WWN in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • How to Capture More Logs in /var/log/dmesg for CentOS/RHEL
  • Unable to Start RDMA Services on CentOS/RHEL 7
  • How to rename a KVM VM with virsh
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary