Re: systemd can't start a dæmon and doesn't give any error either
- Date: Mon, 8 Oct 2018 09:02:18 -0400
- From: Greg Wooledge <wooledg@xxxxxxxxxxx>
- Subject: Re: systemd can't start a dæmon and doesn't give any error either
On Mon, Oct 08, 2018 at 06:17:52PM +0800, Weiwu Zhang wrote:
> To show this dæmon itself is properly configured and runs fine on Debian 9.5:
> # su bitcoin
> $ cd
> $ /usr/local/bin/bitcoind -daemon
> Bitcoin server starting
> $ pgrep bitcoind
You've used an option named "-daemon". I am guessing that this causes
the process to "daemonize" itself (auto-background, self-background).
This is what you want if you're on a BSD system in 1989.
This is NOT what you want if you're on a systemd system in 2018.
If you omit the -daemon option, does the process run in the foreground?
If so, THAT is what you want.
> However, it won't start if converted to a systemd service:
> # cat /etc/systemd/system/bitcoin.service
> ExecStart=/usr/local/bin/bitcoind -daemon
You did not specify what TYPE of service this is. Since you didn't specify
a Type= option, systemd uses the default, which is "simple", which means
that it expects a single process to run in the foreground.
So: either omit that "-daemon" option, or whatever it takes to make the
process run in the foreground like a good process should.
Tell systemd that your process uses ancient, broken behavior
(self-backgrounding) by specifying "Type=forking".
I know which one I would pick. Assuming that dropping -daemon does what
I am guessing it does. (If my guess is wrong, then you may be forced
to use a non-simple Type= option.)