[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] Systemd and forking programs (was systemd can't start a dæmon and doesn't give any error either)

On Tue, Oct 09, 2018 at 12:13:31PM +0530, Didar Hossain wrote:


> Please explain as to why "forking" is "broken" behaviour so that I can make
> informed decisions whether I should use forking or not in my own scripts.

Systemd's stance is that it wants to supervise the processes it creates. And
the most effective way to do that is to keep them as children; that's what
old BSD init did, and what other process supervision programs (e.g. runit)
do. They can watch closely when one of their children die and take action.

The whole PID thing came up with SysV init and is a crutch: many things
can happen: process dies, leaving behind the PID file, so you have to
check explicitly whether process is still running (in itself a race
condition), PIDs "wrap around", so if process died a while ago, the
PID may be active again for a totally unrelated process, etc. etc.

Not pretty.

Now systemd is very opinionated [1] software, and "there is just one
way to do it", so the daemons serviced by it have to behave in this
one way (stay in the foreground).

> Again this is not a flame bait, I just want to understand Pros and Cons.

No worries: flame baits tend to have a strong smell :-)

[1] That's why some of us don't like systemd: personally, I think it's
   OK for people to have (sometimes strong) opinions, but I don't
   really like software to have opinions, especially if they try to
   override mine.

-- tomás

Attachment: signature.asc
Description: Digital signature

Reply to: