bitcoind daemon mode

0

  1. When running bitcoind from a systemd service, as in https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service, what is the role of the -daemon flag?

Basically I'm asking what does -daemon do in a situation where bitcoind is run as service, and not as a wallet. And what happens if -daemon is not used -> in a systemd service file.

  1. If one sets daemon=1 in bitcoin.conf, is it redundant to also use the -daemon flag when starting

user2066480

Posted 2018-04-18T17:56:20.130

Reputation: 115

Answers

0

When running bitcoind from a systemd service, as in https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service, what is the role of the -daemon flag?

-daemon starts bitcoind in the background as a daemon. So if you run bitcoind -daemon in the terminal, the program will exit immediately but bitcoind is still running in the background. Without -daemon, you will see that bitcoind appears to hang in the terminal, but that just means it is running. If you stop the command, then bitcoind will stop as well.

If one sets daemon=1 in bitcoin.conf, is it redundant to also use the -daemon flag when starting

Yes. This applies for all command line options.

Andrew Chow

Posted 2018-04-18T17:56:20.130

Reputation: 40 910

Yes, I see that the terminal seems 'occupied' or 'hanging' when the daemon setting is turned off. But my question was not about starting the daemon in terminal, but in a systemd service. In this case what is the consequence of running with the daemon setting turned on, or going instead Type=simple and no daemon does the job correctly also?user2066480 2018-04-18T21:48:45.923

As I explained in your other question about this, you cannot use Type=simple without -daemon. Systemd will not work with that.Andrew Chow 2018-04-18T22:18:06.107

In the other question about forking vs simple, you made a case against using Type=simple together with daemon=1. In my comment above I was asking for Type=simple together with daemon=0.user2066480 2018-04-18T22:37:04.510

I see. There is no difference between using Type=simple and daemon=0 and using Type=forking and daemon=1.Andrew Chow 2018-04-18T23:01:56.050

From my experience Type=simple and daemon=1 in btc conf file, makes daemon shotdown just after start with systemctl startPawel Cioch 2018-12-20T23:12:52.467

I just tested Type=forking is needed when daemon=1 flag is usedPawel Cioch 2018-12-20T23:20:12.450