----- Original Message ----- > From: "J Fernyhough" <[email protected]> > To: "ubuntu-devel-discuss" <[email protected]> > Sent: Wednesday, April 5, 2017 2:01:26 PM > Subject: Re: Set environment variable globally
> On 24/03/17 21:19, Andrew Martin wrote: >> Hello, >> >> I recently saw this blog post regarding performance when the TZ environment >> variable is not set: >> https://blog.packagecloud.io/eng/2017/02/21/set-environment-variable-save-thousands-of-system-calls/ >> > > There's also a good deal of discussion on the HN thread: > https://news.ycombinator.com/item?id=13697555 Thanks, I had not seen this! > >> I tried defining TZ in /etc/environment and in /etc/profile.d/test.sh, but I >> cannot get this environment variable to be available in all cases (e.g. if I >> just execute bash without --login or if I run the sample c program provided >> in >> the above article). How can I make the TZ environment variable defined >> completely system-wide? > > Before you go too far with that, is there a specific reason you want to > do this? For example, there's not generally a lot of advantage unless > you have a process that does a lot of timezone-based processing. > > However, all you should need in /etc/environment is: > > TZ=:/etc/localtime > > or an equivalent TZ value, e.g.: > > TZ=:Europe/London > I've noticed apache2 reading /etc/localtime a lot when running; this is also mentioned in the HN thread: http://mail-archives.apache.org/mod_mbox/httpd-dev/201111.mbox/%3CCAMDeyhzRAZ4eyz%3D%2BstA%3DwoTibM-W6QL8TqT%2BaPio07UddCz7Tg%40mail.gmail.com%3E It seems like that would have some performance impact. Setting TZ in the /etc/environment file doesn't appear to be used by upstart or systemd, and therefore apache2 doesn't use it either. How can I make it be used for services started by either init system? Thanks, Andrew -- Ubuntu-devel-discuss mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss
