Bug 758047

Summary: RFE: allow local customization of units
Product: [Fedora] Fedora Reporter: Enrico Scholz <rh-bugzilla>
Component: systemdAssignee: systemd-maint
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: johannbg, lpoetter, metherid, mschmidt, notting, plautrba, systemd-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-02 09:34:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Enrico Scholz 2011-11-29 09:23:52 UTC
Description of problem:

It would be nice when units could be customized locally. E.g. the stop timeout of proxy servers (tor, squid) depends on the use case and should be customizable by the administrator.

First tries like

| [Service]
| Environment = TOR_SHUTDOWN_WAIT=30
| Environment = TOR_NOFILE=4096
| EnvironmentFile = -/etc/sysconfig/tor
| TimeoutSec = ${TOR_SHUTDOWN_WAIT}
| LimitNOFILE = ${TOR_NOFILE}

do not work because environment variables are expanded for special stanzas only.

A solution might be service files ending with .append (e.g. '/etc/systemd/systemd/tor.service.append') which are (logically) appended to existing units and can override default settings.

This would make it also possible, to define behavior of foo@ units depending on the instance.

Comment 1 Michal Schmidt 2011-11-29 11:42:45 UTC
You can override packaged units by adding unit files in /etc/systemd/system. There you can use ".include" and override only the settings you want. See
http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
This mechanism should be sufficient for your use-case. Is it not?


There is an entry on the systemd TODO list to add another mechanism:
* read config fragments for all units from /lib/systemd/system/foobar.service.d/ to override/extend specific settings

Comment 2 Enrico Scholz 2011-12-02 09:34:17 UTC
thx; will work in the described way