<p dir="ltr"><br>
On Dec 5, 2013 11:27 AM, "Cecil Westerhof" <<a href="mailto:Cecil.Westerhof@snow.nl">Cecil.Westerhof@snow.nl</a>> wrote:<br>
><br>
> On 12/05/2013 10:08 AM, Mantas Mikulėnas wrote:<br>
>><br>
>>  > One of the problems mentioned is that services can be started only<br>
>> when they are used for the first time. As I understood it, you can make<br>
>> sure that a service is always loaded, so that there is no waiting time<br>
>> the first time it is called.<br>
>><br>
>> This is not a problem. This is a configuration choice. If the service<br>
>> supports activation, you *can* let it be activated if that suits you,<br>
>> but you can also configure it to be started on boot as any other service<br>
>> (i.e. make multi-user.target depend on the service directly).<br>
><br>
><br>
> OK, when I use:<br>
> [Install]<br>
> WantedBy=multi-user.target<br>
><br>
> What I did until now, the service is just started.<br>
><br>
> When I do not use it, only a socket is made and it is started the first time it is used.<br>
><br>
> Correct?</p>
<p dir="ltr">Mostly, yes. All units of all types can have an [Install] section for 'systemctl enable', they can be permanently enabled if the package installs them to foobar.target.wants/, etc. (For example, sockets usually have WantedBy=sockets.target)</p>

<p dir="ltr">In other words, you're correct but should remember that a .socket has to be enabled too, just like any other unit.<br></p>
<p dir="ltr">><br>
><br>
> When a service is started because it was used (loaded on the first use), does it keeps running, or is it unloaded after some time? Or can this be configured?</p>
<p dir="ltr">systemd has no way of knowing when the service becomes idle, therefore the service itself must be programmed to exit when unneeded.</p>
<p dir="ltr">(Meanwhile, with inetd-style aka Accept=yes services, there is exactly one instance per connection, so if there are no connections, there aren't any instances either.)<br></p>
<p dir="ltr">><br>
><br>
><br>
>>  > I understood you could deny a service network connection. How is this<br>
>> done? Until no I could not find it. Is it possible to limit the<br>
>> bandwidth a service is allowed to use?<br>
>><br>
>> PrivateNetwork=yes will create a dedicated net namespace for that<br>
>> service, which does not have any network interfaces by default.<br>
>> (Relevant man pages: clone, unshare, setns, nsenter; LXC also uses this.)<br>
><br>
><br>
> OK, it is an on/off switch. There is not a possibility to limit the bandwidth?</p>
<p dir="ltr">It might be possible, by moving a virtual interface (veth) into the same namespace, then bridging it with eth0, and setting up traffic shaping or something. But network namespaces are meant to provide separation, so extra features probably were not part of the original design... (Does LXC support this?)</p>

<p dir="ltr">><br>
><br>
> Met vriendelijke groet,<br>
><br>
><br>
><br>
> Cecil Westerhof<br>
> Engineer<br>
> mobiel +31 - 6 - 25 00 38 81<br>
><br>
> -- <br>
><br>
> Snow B.V.<br>
> Unix Specialists<br>
> De Ooyen 11<br>
> 4191 PB Geldermalsen<br>
><br>
> <a href="http://www.snow.nl">http://www.snow.nl</a><br>
> tel. +31 - 345 - 65 66 66<br>
><br>
> _______________________________________________<br>
> systemd-devel mailing list<br>
> <a href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/systemd-devel">http://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
</p>