I have the following systemd .target:
[Unit]
Description=My Target
After=network-online.target
Wants=one-service@%i.service
Wants=two-service@%i.service
BindsTo=one-service@%i.service
BindsTo=two-service@%i.service
[Install]
WantedBy=default.target
Also=one-service@%i.service
Also=two-service@%i.service
And the (one, though both are the same, just different ExecStart=
values) .service:
[Unit]
Description=one service
PartOf=my@%i.target
ReloadPropagatedFrom=my@%i.target
[Service]
Type=forking
ExecStart=/path/to/my-first-command -${SOME_VAR_DEFINED_IN_ENV_FILE}
PIDFile=/path/to/pidfile
SuccessExitStatus=0
TimeoutStartSec=180s
TimeoutStopSec=180s
RemainAfterExit=true
[Install]
WantedBy=my.target
I then enable the target with systemctl enable [email protected]
I then execute systemctl edit [email protected]
; with the following:
[Service]
User=oneusername
Group=onegroup
EnvironmentFile=/home/%u/etc/%i.environment
I then execute systemd daemon-reload
, followed by systemctl start [email protected], which fails because the variables in the EnvironmentFile aren't loaded.
However, when I enable and start the target, the variables I've placed in the environment file do not appear to be read, as the service fails because it can't find the variable substitution. I know I'm doing something wrong, but I don't know what.
Tried to enable systemd target with service, service has variables that should be read by EnvironmentFile, but the EnvironmentFile isn't being read.
EDIT: corrected typo, originally there was Service] when it should have been [Service]