3

I have configured the timezone in my servers for a custom timezone (America/Mexico_city) by creating a dynamic link in /etc/localtime.

Nevertheless, every now and then and with no apparent reason, my timezone goes back to default (PST) and my services start failing.

I'm using HP Cloud services.

Has anybody else experienced this?

Oso
  • 143
  • 4
  • Does `/etc/timezone` perhaps contain the name of the default timezone? I don't know how it is in CentOS but it could be that `/etc/localtime` is periodically regenerated from the contents of `/etc/timezone`. – Celada Jun 26 '12 at 03:11
  • @Celada Why not phrase this as an answer? In my case there is no /etc/timezone – jerclarke Oct 02 '14 at 18:14
  • I didn't phrase it as an answer @jeremyclarke because it is a bit of a wild guess I was just hoping might be lucky. Based on the fact that you are saying that your system does not have a `/etc/timezone` the guess is probably a miss. – Celada Oct 02 '14 at 22:41

2 Answers2

2

Setting the timzezone via /etc/localtime symlinks should be avoided. CentOS 6 gets timezone settings from /etc/sysconfig/clock

/etc/localtime will get updated if one of the time config scripts is run.

Timezones can also be overridden in scripts by setting/exporting a TIMEZONE variable. You can always set an explicit TIMEZONE in the start-up script of a service that is sensitive to TZ changes.

Aaron
  • 2,809
  • 2
  • 11
  • 29
1

It's a known bug, resolved after Centos/RedHat 6.8 https://bugzilla.redhat.com/show_bug.cgi?id=1200555

Anyway, do not symlink /etc/localtime, use the recommended procedure:

A patch has been applied to address the problem and /etc/localtime as a symbolic link is no longer replaced. For optimum compatibility, it is recommended not to modify /etc/localtime directly. Instead, edit the /etc/sysconfig/clock configuration file and execute the tzdata-update command afterwards.

Fran
  • 11
  • 2