I changed the time zone of my server (Ubuntu 12.04) to UTC via:
echo 'UTC' > /etc/timezone
dpkg-reconfigure --frontend noninteractive tzdata
When running date
, I can see the time is now in UTC.
However, on /var/log/syslog, it still displays the time with the previous setup timezone and not UTC. Why ?
How to make it take effect on the whole system? Reboot?
Thanks.
To have the syslog daemon pick up the new time zone, use the command: In general you will have to restart every process on the system that you want to see the new timezone. If there’s only one or two, like syslog, that you care about, then you can restart them individually, but you’re probably better off rebooting and getting everything consistent.
How to Set Universal Time (UTC) in Ubuntu. UTC stands for Coordinated Universal Time and is used for scientific calculations and synchronizing between timezones across the globe. You can synchronize your system by entering the following command: timedatectl set–timezone UTC.
The time zone and system clock synchronized values show that the new local time was updated successfully. Users of Ubuntu versions such as 16.04 or lower can set their timezones by reconfiguring the timezone and daylight saving time data or tzdata. It contains files documenting both current and historical transitions of time zones around the world.
Checking the Current Timezone timedatectl is a command-line utility that allows you to view and change the system’s time and date. It is available on all modern systemd-based Linux systems, including Ubuntu 20.04. To print the current system’s timezone invoke the timedatectl without any arguments:
To have the syslog daemon pick up the new time zone, use the command:
sudo service rsyslog restart
I found the name of the service to restart with:
ls /etc/init.d/*log*
In general you will have to restart every process on the system that you want to see the new timezone. If there’s only one or two, like syslog, that you care about, then you can restart them individually, but you’re probably better off rebooting and getting everything consistent.
To switch to UTC, simply execute sudo dpkg-reconfigure tzdata, scroll to the bottom of the Continents list and select Etc; in the second list, select UTC. If you prefer GMT instead of UTC, it's just above UTC in that list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With