Sujet : Re: Systemd ... Pass CL Params to Pgm ?
De : robin_listas (at) *nospam* es.invalid (Carlos E.R.)
Groupes : comp.os.linux.miscDate : 12. Jun 2025, 11:27:47
Autres entêtes
Message-ID : <3mmqhlxcct.ln2@Telcontar.valinor>
References : 1 2 3
User-Agent : Mozilla Thunderbird
On 2025-06-12 11:58, The Natural Philosopher wrote:
On 12/06/2025 09:07, Carlos E.R. wrote:
EnvironmentFile=-/etc/sysconfig/spamd
You have a directory called /-etc ???
No. The dash has a meaning in systemd parlance. I confess to not knowing what, so I asked chatgpt after looking perfunctorily at "
https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html". This is the answer:
In a **systemd** service file, the line:
```
EnvironmentFile=-/etc/sysconfig/spamd
```
includes a **dash (`-`)** before the path. This dash is **significant**—it tells `systemd` to **ignore** the file **if it does not exist**.
### Meaning of the dash:
* `EnvironmentFile=/etc/sysconfig/spamd` → systemd **fails** to start the service if the file is missing.
* `EnvironmentFile=-/etc/sysconfig/spamd` → systemd **ignores the missing file** and continues starting the service without error.
### Use case:
This is helpful when the environment file is **optional** or only present in certain configurations or environments.
### Summary:
The dash (`-`) before the path means:
> *"Use this environment file if it exists; otherwise, proceed without it."*
Let me know if you want a breakdown of how `EnvironmentFile` works with variables.
-- Cheers, Carlos.