[systemd-devel] Set environment for user at .service

subi.the.dream.walker at gmail.com subi.the.dream.walker at gmail.com
Sat Mar 1 19:22:53 PST 2014


Hi,

Before systemd 209, I put 'Environment=ENV=%h/.somedir' in
/etc/user at .service.d/env.conf to set some variables. Now since %h is not
available for system units anymore, I take the workaround by adding a
user unit set-my-env.service:
-------------
[Unit]
Description=Set systemd environment
Before=default.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=-/usr/bin/systemctl --user set-environment ENV=%h/.somedir

[Install]
WantedBy=basic.target
------------

The problem is that set-my-env.service may not affect the early units
pulled in by default.target. I wonder how we can execute
set-my-env.service as soon as user at .service is started. Thanks.

Regards.


More information about the systemd-devel mailing list