[systemd-devel] Best practices for lots of similar units?
Lennart Poettering
lennart at poettering.net
Tue Jul 28 15:21:53 UTC 2020
On Fr, 24.07.20 00:12, Roman Odaisky (roma at qwertty.com) wrote:
> Hi All,
>
> Suppose I want to run a number of similar services that all require the same
> boilerplate. How to avoid repeating myself when creating unit files?
Three options:
1. Use templating, works great if you have a single parameter
2. Use drop-ins, i.e. define separate unit files for each instance,
listing only the stuff that actually differs in each instance,
and pull in the common stuff via a drop-in you symlink into the .d/
subdir of each instance. Covers things nicely, but of course only
works to override or extend full lines.
3. Use a template engine/macro language of your choosing, such as m4 or so.
> Let’s take a concrete example, websites. The boilerplate is as follows:
>
> [Unit]
> After=syslog.target
No need for this, it's not needed anymore today.
> StandardError=syslog
Also remove this line.
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list