<blockquote>
  <p>What is the implication of one or the other in the light of how bitcoind starts and runs?</p>
</blockquote>

<p>Forking mode means that the program is going to call <code>fork()</code> and the process runs in the background while the main process exits. Simple mode means that the process stays running and doesn't exit unless the service is closed.</p>

<p>Since the <code>.service</code> file runs Bitcoin Core with <code>-daemon</code>, this means that it will call <code>fork()</code> and run in the background with the main process exiting. This is why it uses Forking mode.</p>

<blockquote>
  <p>All other coins based on bitcoin share the same behaviour on this matter, or is this something that is likely to be modified by coin devs?</p>
</blockquote>

<p>They share the same behavior because they are all based on Bitcoin Core. They all have the <code>-daemon</code> option.</p>

CC BY-SA 3.0
2018-04-18T18:26:33.610Z
Running bitcoind without calling -daemon but having daemon=1 in the .conf is the same thing?
user2066480
CC BY-SA 3.0
2018-04-18T18:51:08.490Z
Could you expand on the consequences of combining Type=simple and running bitcoind with the -daemon flag?
user2066480
CC BY-SA 3.0
2018-04-18T20:08:11.013Z
Yes, -daemon and daemon=1 in the conf are the same thing. Running with Type=simple but -daemon means that once the process exits, systemd will think that it has stopped when in reality it is still running because a forked process was spawned in the background. Because it thinks the process stopped, it may attempt to restart it which could result in many forks of the bitcoind process (although those should exit once one bitcoind process exists).
Ava Chow
CC BY-SA 3.0
2018-04-19T17:44:23.157Z
So there are no consequences in terms of performance, stability, resource usage?... one or the other yields the same result, as long as the daemon flag agrees?
user2066480
CC BY-SA 3.0
2018-04-19T17:59:24.640Z
Yes, there is no performance difference.
Ava Chow
CC BY-SA 3.0
2018-04-18T17:14:28.000Z
2018-04-18T17:14:28.000Z
Ava Chow
<p>When creating a systemd service file for bitcoind (for example <a href="https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service</a>), does it matter if <code>Type=forking</code> or <code>Type=simple</code>? What is the implication of one or the other in the light of how bitcoind starts and runs?</p>

<p>All other coins based on bitcoin share the same behaviour on this matter, or is this something that is likely to be modified by coin devs?</p>

<bitcoind>
bitcoind systemd service: forking or simple?
user2066480
# bitcoind systemd service: forking or simple?

(Asked by: username_0 on 2018-04-18)

When creating a systemd service file for bitcoind (for example <https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service>), does it matter if `Type=forking` or `Type=simple`? What is the implication of one or the other in the light of how bitcoind starts and runs?

All other coins based on bitcoin share the same behaviour on this matter, or is this something that is likely to be modified by coin devs?

**Tags:** bitcoind


---

## 1 answers

### Answer by username_1 on 2018-04-18. Score: 0 | Accepted answer

> What is the implication of one or the other in the light of how bitcoind starts and runs?

Forking mode means that the program is going to call `fork()` and the process runs in the background while the main process exits. Simple mode means that the process stays running and doesn't exit unless the service is closed.

Since the `.service` file runs Bitcoin Core with `-daemon`, this means that it will call `fork()` and run in the background with the main process exiting. This is why it uses Forking mode.

> All other coins based on bitcoin share the same behaviour on this matter, or is this something that is likely to be modified by coin devs?

They share the same behavior because they are all based on Bitcoin Core. They all have the `-daemon` option.

> **Comments:**
> **username_0**: Running bitcoind without calling -daemon but having daemon=1 in the .conf is the same thing?  
> **username_0**: Could you expand on the consequences of combining Type=simple and running bitcoind with the -daemon flag?  
> **username_1**: Yes, -daemon and daemon=1 in the conf are the same thing. Running with Type=simple but -daemon means that once the process exits, systemd will think that it has stopped when in reality it is still running because a forked process was spawned in the background. Because it thinks the process stopped, it may attempt to restart it which could result in many forks of the bitcoind process (although those should exit once one bitcoind process exists).  
> **username_0**: So there are no consequences in terms of performance, stability, resource usage?... one or the other yields the same result, as long as the daemon flag agrees?  
> **username_1**: Yes, there is no performance difference.  

---

