<div dir="auto">If you only care about processes on the same system – why not put the actual socket in /run, as an AF_UNIX socket? That's mostly what /run is for.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 15, 2021, 04:18 John Ioannidis <<a href="mailto:systemd-devel@tla.org">systemd-devel@tla.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I have an instanced service that gets started and stopped by another service: <b>alice.service </b>runs the equivalent of <b>systemsctl start alice@foo.service, systemctl start alice@bar.service, systemctl stop alice@cat.service</b>, and so on. <div>Each of the instanced services runs a little http service so its status can be monitored, metrics scraped, etc. The tcp port on which that service runs is just whatever the kernel allocated. I want to export that port number so other processes can find it and use it, for example, by doing the equivalent of <b>systemctl list-units | grep alice@ </b>so they find which instances are actually running, and then going about finding the corresponding ports.</div><div><br></div><div>I can think of a number of ad hoc ways:</div><div><br></div><div>* they can write the port number in a file like /run/alice/foo.port, /run/alice/bar.port, and whoever is interested can go read those files, in the same way that we use .pid files. </div><div>* They can use systemd-notify to export it as "Status"</div><div>* Using a service discovery mechanism would be an overkill, especially since whatever is actually talking to those ports is on the same host as the services themselves, but that's also a possibility.<br></div><div><br></div><div>Is there a systemd-native way of accomplishing this? It would be nice if it were possible to have user-defined properties that could be set with <b>systemctl set-property</b>, but that is not the case.</div><div><br></div><div>Thanks</div><div><br></div><div>/ji</div></div>
_______________________________________________<br>
systemd-devel mailing list<br>
<a href="mailto:systemd-devel@lists.freedesktop.org" target="_blank" rel="noreferrer">systemd-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
</blockquote></div>