Omid Samir

Omid Samir

Network Engineer, Virtualization Specialist & Datacenter Expert

Disable DST on Linux Servers

To disable DST (Daylight Saving Time) on a Linux server, you can use the timedatectl command. Here is a Bash script that will disable DST on the system:

#!/bin/bash

# Check if the script is being run as root
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root" 
   exit 1
fi

# Disable DST
timedatectl set-local-rtc 1 --adjust-system-clock

This script first checks if it is being run as root. If it is not, it will print an error message and exit. If it is being run as root, it will use the timedatectl command to disable DST by setting the system clock to use the local time instead of UTC. This will ensure that the system’s clock remains consistent even when DST is not in effect.