![change timezone linux without reboot change timezone linux without reboot](https://www.howtogeek.com/thumbcache/648/248/e0ec7a3feef547285ef100679e056ab7/wp-content/uploads/sg/2010/06/cap12.jpg)
The -g option overrides this check and the clock will be set to the server time regardless of the chip time. This causes ntpd to exit with a panic message to the system log. In case there is no TOY chip or for some reason its time is more than 1000s from the server time, ntpd assumes something must be terribly wrong and the only reliable action is for the operator to intervene and set the clock by hand. After the machine has synchronized to a NTP server, the operating system corrects the chip from time to time. When the machine is booted, the chip is used to initialize the operating system time.
![change timezone linux without reboot change timezone linux without reboot](https://1.bp.blogspot.com/-PK4GXEeUIYU/VtjtNJ2qv4I/AAAAAAAAFXc/vcBRkTyWQZw/w1200-h630-p-k-no-nu/image-775374.png)
Most operating systems and hardware of today incorporate a time-of-year (TOY) chip to maintain the time during periods when the power is off. The reason for this is given in the ntpd man page ( ):
![change timezone linux without reboot change timezone linux without reboot](https://medhahosting.com/wp-content/uploads/2020/08/Pink-and-Blue-Galaxy-Gaming-Youtube-Channel-Art-12-768x432.jpg)
#Change timezone linux without reboot update#
The time will not automatically update unless you make this change. So, importantly you must replace the line “ExecStart=/usr/bin/ntpdate-sync silent” with the line “ExecStart=/usr/bin/ntpd -q -g -x”. If you go into the directory /usr/share/zoneinfo you will see a lot of different timezone files, e.g. Next you need to set your /etc/localtime file according to your timezone. Set your localtime file according to your time zone Setting the logfile above is very useful as it allows you to check the /var/log/ntpd.log file to see what is going wrong if you are having problems. Important – make sure that you comment out the server and fudge lines or the server will sync to itself! In my case, 192.168.1.0 is the IP address of my network and 255.255.255.0 is my network’s netmask. If you only want to allow machines within your own network to synchronize their clocks with your server, but ensure they are not allowed to configure the server, set the restrict value as above. This file contains internal information for NTP – leave it at /etc/ntp.drift The driftfile specifies the file that is used to store information about previous responses from the NTP servers you are using. In addition to the symlink, it is also necessary to edit the /etc/sysconfig/clock file, and change it to your local timezone ( in my case ZONE="Australia/Perth" ).Īfter making both of these changes, be sure to reboot your server, and then use the date command to check that your server is still in your local timezone (rather than UTC).Restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap Luckily, the solution was hidden away in the AWS user guide. To set the timezone, I had always created a /etc/localtime symbolic link pointing to /usr/share/zoneinfo/Australia/Perth, however it turns out that there is one other thing that has to be done in order to make the timezone setting be persistent across updates and reboots. Recently our Rackspace Cloud servers and Amazon EC2 instances (both running CentOS) were rebooted after updating the glibc package, which caused each server’s timezone to revert back to UTC. This makes sense for many reasons, mostly that when we set up a cron job, we can use local time (rather than UTC), which makes life very easy. Being based in Perth (GMT +8), I have always thought it made sense to have our servers running in the Australia/Perth timezone (rather than UTC).