Time: 5 minutes

Instead of needing to start Bitcoin Core manually, it would be nice to start it automatically. This could be useful after restarting your Pi or if bitcoind crashes for some reason. Linux has systemd services for automated tasks like that. Before you start automating, please make sure Bitcoin Core (bitcoind) is turned off. You can do it this way:

bitcoin-cli stop

When bitcoind is turned off we can start creating the service.

sudo nano /etc/systemd/system/bitcoind.service

Paste this in there.

Description=Bitcoin Daemon

Save the file with Crtl + X and confirm with Y.

The system needs to be notified about the new service which can afterwards be started.

sudo systemctl enable bitcoind
sudo systemctl start bitcoind

If you'd want to see whether it started correctly, run the command below. Note: it can take a minute or so before you get a response that tells you everything is alright.

systemctl status bitcoind

It could be possible things don't work from the get-go. That would be the case if your output doesn't looks like this:

● bitcoind.service - Bitcoin Daemon
Loaded: loaded (/etc/systemd/system/bitcoind.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-01-14 12:20:53 UTC; 2s ago
Main PID: 40483 (bitcoind)
Tasks: 12 (limit: 4203)
CGroup: /system.slice/bitcoind.service
└─40483 /usr/local/bin/bitcoind
Jan 14 12:20:53 ubuntu systemd[1]: Started Bitcoin Daemon.
Jan 14 12:20:53 ubuntu bitcoind[40482]: Bitcoin Core starting

Try the same command another few times, because it could take up to a minute before bitcoind is started correctly by the service.

If you'd like to see an overview of the status over multiple sessions, use this:

sudo journalctl -f -u bitcoind