[systemd-devel] Accpetance of Environment Variables in Attributes

Ede Wolf listac at nebelschwaden.de
Thu Jun 25 20:04:19 UTC 2020


> what exactly stands in your way to use
> ExtecStart=/usr/local/bin/myscript.sh?


Because my question was about making a template unit file more dynamic, 
not the process called by the unit.

Having an environmentfile %i.env, that a) defines the environment for 
the actual service to be called (ExecStart=myservice --$OPTIONS...) but 
b) is also able to set different limits for that other instance of the 
same service.  Because a test webserver may be more restricted in 
resources.

This way I would only have to take care of _one_ external file to get 
another instance of service foo up and running. Copy the file, change 
the few options for the unit as well as for the service in ONE place, 
startup the template. Ultra elegant and fast, especially when dealing 
with 10+ instances of the same service, that only have little variation 
like the running user, limits and one or two different service arguments.

That is why drop-ins are no help, creating those makes as much work as 
copying the unit file itself and change the unit values manually.

Would have been useful, but I've learned, it is not possible.


More information about the systemd-devel mailing list