Re: [OT] Systemd and forking programs (was systemd can't start a dæmon and doesn't give any error either)
- Date: Tue, 9 Oct 2018 10:31:41 +0100
- From: Jonathan Dowland <jmtd@xxxxxxxxxx>
- Subject: 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.
Again this is not a flame bait, I just want to understand Pros and Cons.
If you a program that doesn't fork, but you want to run it in the
background, you can: either by invoking it with '&' in an interactive
shell, or suspending it in an interactive shell and issuing the "bg"
command. There are similar ways in non-interactive environments, and
a myriad other ways (execute via cron, or at, etc.)
If you have a program that does fork, but you don't want it to, there's
nothing you can do to stop it.
Modern init systems (like systemd) can manage programs that do not fork,
so there's no need to do when being used in conjunction with such
So not forking gives the user more control. It's also the simpler
implementation, and not necessary with modern init systems.
⣾⠁⢠⠒⠀⣿⡁ Jonathan Dowland
⠈⠳⣄⠀⠀⠀⠀ Please do not CC me, I am subscribed to the list.