On 06/04/17 16:36, Andrew Martin wrote:
> 
> 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?
> 

Not sure about upstart, but systemd should be straightforward enough.
You can add environment variables through editing the unit file
directly, or possibly better by:

1) Adding a conf file, e.g. in
/etc/systemd/system/apache2.service.d/tz.conf:

[Service]
Environment="TZ=:/etc/localtime"

2) globally for all units in /etc/systemd/system.conf, or e.g.
/etc/systemd/system.conf.d/tz.conf:

[Manager]
DefaultEnvironment="TZ=:/etc/localtime"


You'll need to do a daemon-reload and a service restart to pick up the
changes, but it should be there. Terrible, hacky, one-liner to check:

for p in $(pgrep -d" " apache2); do echo -e "$p:\n$(cat
/proc/$p/environ)\n"; done

J


https://www.freedesktop.org/software/systemd/man/systemd-system.conf.html

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
Ubuntu-devel-discuss mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss

Reply via email to