[systemd-devel] Need advice on daemon's architecture

Hoyer, Marko (ADITG/SW2) mhoyer at de.adit-jv.com
Sun Nov 3 05:42:30 PST 2013


> -----Original Message-----
> From: systemd-devel-bounces at lists.freedesktop.org [mailto:systemd-devel-
> bounces at lists.freedesktop.org] On Behalf Of Colin Guthrie
> Sent: Sunday, November 03, 2013 12:54 PM
> To: Peter Lemenkov; systemd-devel at lists.freedesktop.org
> Subject: Re: [systemd-devel] Need advice on daemon's architecture
> 
> 'Twas brillig, and Peter Lemenkov at 03/11/13 06:40 did gyre and gimble:
> > Hello All!
> > I'm working on a system service which uses systemd intensively. Right
> > now it's socket-activated, with main service of type "simple". I
> > recently added support for querying and publishing some internals via
> > D-Bus, so it has a D-Bus name now. Does it add anything if I change
> > type of a main service to "dbus" thus allowing systemd to know for
> > sure if my service is fully initialized?
> 
> 
> If you are using systemd intensively, then you may want to use Type=notify.
> 
> With type=dbus, systemd will consider things ready when you take the name on
> the bus, but this might not actually be the last thing you do to initialise
> your daemon (although if this is the only interface for clients this is not a
> problem!).
> 
> You still might want to use sd_notify() instead. This can also pass through
> some internal performance info to systemd which will show up on systemctl
> status output which is kinda nice.
> 
> Col
> 
> 
> --
> 
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
> 
> Day Job:
>   Tribalogic Limited http://www.tribalogic.net/ Open Source:
>   Mageia Contributor http://www.mageia.org/
>   PulseAudio Hacker http://www.pulseaudio.org/
>   Trac Hacker http://trac.edgewall.org/
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Isn't the classical Linux way an option to?
- the daemon does its initialization with the calling thread
- once it is done with the initialization, it forks off a process that goes on with the daemons work (the main loop probably)
- the calling thread returns, which signals systemd that the daemon is up now

"Type=forking" must be defined in the .service to support this architecture.

Are there any drawbacks with this solution?

I'm just asking because I'm working at the moment on a daemon that is going exactly this way ... 

Best regards

Marko Hoyer
Software Group II (ADITG/SW2)

Tel. +49 5121 49 6948



More information about the systemd-devel mailing list