<p>To start <code>bitcoind</code> at startup on a system using systemd, use the <a href="https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service" rel="nofollow noreferrer">service configuration provided in contrib/init/</a> from the root of the bitcoin-core repository.</p>
<p>You can then manage <code>bitcoind</code> as any other systemd service (and possibly have some other rely on it, such as a Lightning Network implementation's service).</p>
<pre><code>systemctl start bitcoind
systemctl stop bitcoind
# This enables launching the service at startup
systemctl enable bitcoind
</code></pre>

CC BY-SA 4.0
2020-08-20T08:48:16.953Z
2020-08-20T08:48:16.953Z
Antoine Poinsot
<p>You could add a cron program that runs on startup, creates a temp file to say it has already ran, and then execute. This makes it so that every time cron tries to run the program, it turns out empty.</p>

<p>Example:</p>

<pre><code>touch /tmp/btc.true
[ ! -f /tmp/btc.true ] &amp;&amp; sudo -u $USER sh -c 'HOME=~$USER; bitcoind -daemon'
exit 0
</code></pre>

CC BY-SA 4.0
2019-11-24T17:39:43.293Z
That’s awful. There’s a @reboot flag for cron if you want to be hacky.
Claris
CC BY-SA 4.0
2019-11-25T18:11:49.763Z
Ok, I'm noobie in this theme, I really dont understand so well... My main question is why not to use systemctl enable bitcoind?
Daveeee
CC BY-SA 4.0
2019-11-23T23:51:24.570Z
2019-11-23T23:51:24.570Z
Sunflower
<p>I have <code>bitcoind</code> installed on my VPS runing Ubuntu 18.04, and I want to configure it to launch <code>bitcoind</code> on startup.</p>
<p>What the best way to do so with my configuration ?</p>

CC BY-SA 4.0
2019-11-23T20:22:15.293Z
There’s a suitable systemd configuration for bitcoind in the contrib directory.
Claris
CC BY-SA 4.0
2020-08-20T08:49:26.483Z
Wanted to close this question but finally posted an answer as i could not fine a decent motivation (aside from "there is a major troll as the only answer" :p). Will also edit for clarity.
Antoine Poinsot
<bitcoind><ubuntu>
Launch bitcoind at startup on Ubuntu
Daveeee
# Launch bitcoind at startup on Ubuntu

(Asked by: username_0 on 2019-11-23)

I have `bitcoind` installed on my VPS runing Ubuntu 18.04, and I want to configure it to launch `bitcoind` on startup.

What the best way to do so with my configuration ?

**Tags:** bitcoind, ubuntu

> **Comments:**
> **username_1**: There’s a suitable systemd configuration for bitcoind in the contrib directory.  
> **username_2**: Wanted to close this question but finally posted an answer as i could not fine a decent motivation (aside from "there is a major troll as the only answer" :p). Will also edit for clarity.  

---

## 2 answers

### Answer by username_2 on 2020-08-20. Score: 2

To start `bitcoind` at startup on a system using systemd, use the [service configuration provided in contrib/init/](https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service) from the root of the bitcoin-core repository.

You can then manage `bitcoind` as any other systemd service (and possibly have some other rely on it, such as a Lightning Network implementation's service).

```
systemctl start bitcoind
systemctl stop bitcoind
# This enables launching the service at startup
systemctl enable bitcoind

```


---

### Answer by username_3 on 2019-11-23. Score: -1

You could add a cron program that runs on startup, creates a temp file to say it has already ran, and then execute. This makes it so that every time cron tries to run the program, it turns out empty.

Example:

```
touch /tmp/btc.true
[ ! -f /tmp/btc.true ] && sudo -u $USER sh -c 'HOME=~$USER; bitcoind -daemon'
exit 0

```

> **Comments:**
> **username_1**: That’s awful. There’s a @reboot flag for cron if you want to be hacky.  
> **username_0**: Ok, I'm noobie in this theme, I really dont understand so well... My main question is why not to use systemctl enable bitcoind?  

---

