<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=EN-US link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Much obliged!<br><br>I’ll see if I can carve out a little bit of time to put together a PR for the documentation with the wording I would have expected, and we can see what the maintainers think of my wording and go from there.<br><br>Thanks again!</p><p class=MsoNormal>-Sean</p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal style='border:none;padding:0in'><b>From: </b><a href="mailto:lennart@poettering.net">Lennart Poettering</a><br><b>Sent: </b>Tuesday, February 23, 2021 1:32 AM<br><b>To: </b><a href="mailto:insanescientist@gmail.com">Sean McKay</a><br><b>Cc: </b><a href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.freedesktop.org</a><br><b>Subject: </b>Re: [systemd-devel] What's the best way to generate .conf files on startup?</p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>On Mo, 22.02.21 23:22, Sean McKay (insanescientist@gmail.com) wrote:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>> Hi all,</p><p class=MsoNormal>><o:p> </o:p></p><p class=MsoNormal>> I've been looking to dynamically create .conf files at boot depending on</p><p class=MsoNormal>> the hardware that I'm running on (to set MemoryMax, if it's relevant). I'd</p><p class=MsoNormal>> assumed that the proper way to do this would be by using a generator, since</p><p class=MsoNormal>> the .conf file won't automatically be loaded and would require triggering</p><p class=MsoNormal>> the system manager to reload all configuration. And it didn't seem prudent</p><p class=MsoNormal>> to call that *during* boot.</p><p class=MsoNormal>><o:p> </o:p></p><p class=MsoNormal>> Then I ran across this little snippet in the man page for</p><p class=MsoNormal>> systemd.generator, which seems to imply the opposite:</p><p class=MsoNormal>> Generators should only be used to generate unit files and symlinks to them,</p><p class=MsoNormal>> not any other kind of configuration. Due to the lifecycle logic mentioned</p><p class=MsoNormal>> above, generators are not a good fit to generate dynamic configuration for</p><p class=MsoNormal>> other services. If you need to generate dynamic configuration for other</p><p class=MsoNormal>> services, do so in normal services you order before the service in question.</p><p class=MsoNormal>><o:p> </o:p></p><p class=MsoNormal>> What I'm not clear on is whether this refers solely to configuration used</p><p class=MsoNormal>> by the daemon itself (to use sshd as a well known example - eg:</p><p class=MsoNormal>> /etc/ssh/sshd_config) or if it also refers to drop in .conf files (ie:</p><p class=MsoNormal>> something in /run/systemd/system/ssh.service.d/)</p><p class=MsoNormal>> Put differently, is a drop in considered to be a unit file or to be</p><p class=MsoNormal>> configuration (for the purposes of the above helptext)?</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>It's considered a unit file. I figure we should improve the docs on</p><p class=MsoNormal>that, to make this clearer.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>> Would the recommended solution in this case be for me to use a generator to</p><p class=MsoNormal>> create the relevant .conf file(s) for MemoryMax? Or would it be better to</p><p class=MsoNormal>> use a normal service (with proper ordering against the ones it's modifying)</p><p class=MsoNormal>> to generate those .conf files and call daemon-reload during boot? If the</p><p class=MsoNormal>> latter, are there any expected risks associated with calling daemon-reload</p><p class=MsoNormal>> during boot?</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Doing this with a generator sounds perfect to me.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Lennart</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>--</p><p class=MsoNormal>Lennart Poettering, Berlin</p><p class=MsoNormal><o:p> </o:p></p></div></body></html>