Re: [systemd-devel] Forking service behind socket and service.

2024-04-02 Thread Michal Koutný
Hello.

On Wed, Mar 27, 2024 at 07:35:19AM +, Steve Traylen  
wrote:
> In particular I want the socket to close once the fork happens.
> If the service is Type=forking things do work but socket is persisted
> - that's not great for thing doing the original submission. It expects
> the socket to be short lived.

Why? To only have a single instance of the service?
Could you then do me.socket and me.service with StandardInput=socket?
(I guess not because the legacy won't accept.)

What about .socket:MaxConnection=1 then?

Thanks,
Michal


signature.asc
Description: PGP signature


Re: [systemd-devel] ExecReload and dynamic arguments (start control process with arguments)

2024-04-02 Thread Michal Koutný
Hello.

On Mon, Mar 04, 2024 at 06:47:42PM +0400, Vadim Nevorotin  
wrote:
> One of them - how to support different "reload" modes? We need to start
> some control process in the context of service (like ExecReload does), but
> this process supports some arguments and we need to pass them in time of
> 'systemctl reload' call. Previously we have commands like:
> 
> /etc/init.d/ourservice reload|soft-reload|hard-reload [--someargs]

I assume the command + args must be somehow delivered to the service
process (e.g. written to a socket). (DM)

> All doing different actions, manipulating service main process/workers and
> pidfiles, How can I do it with systemd? Did I miss something in the
> documentation?

It seems to me you're focusing too much on the reload aspect whereas it
is a generic communication with the service (because of the
parametrization).

Simply use the delivery mechanism above (DM) and if it should result in
the replacement of tha mein service process send MAINPID=" via
sd_notify().

HTH,
Michal


signature.asc
Description: PGP signature


Re: [systemd-devel] ExecReload and dynamic arguments (start control process with arguments)

2024-04-02 Thread Andy Pieters
On Mon, 4 Mar 2024 at 14:47, Vadim Nevorotin  wrote:

>
> /etc/init.d/ourservice reload|soft-reload|hard-reload [--someargs]
>
>
I've often wondered, too, how to translate system-v services into systemd,
specifically like with apache or nginx we had gotten things like
configtest,status,fullstatus, etc

yes I know you can use apachectl for that. Or rather used to be able to, as
newer versions now change things again and now you have to use httpd; point
being those commands belong to the "service" and all you had to remember
was this one command, not "ooh sometimes it's service, sometimes it is
apachectl and sometimes it is httpd, but it depends on what distro and what
version etc etc"

(apologies for the rant and highjacking the thread [a little bit])