This how-to describes the steps to set up elementsd as a service running in background.
Assumptions
- Your elementsd is in
/usr/local/bin/
- You will run elementsd as the user
liquid1
- The service will be named
elementsd
- The tests were done on Ubuntu 22.04, but the procedure/commands should work on most Linux distributions.
Steps
1.
Create a file /etc/systemd/system/elementsd.service
with the following content:
[Unit]
Description=Liquid daemon
After=network-online.target
[Service]
User=liquid1
Group=liquid1
Type=simple
ExecStart=/usr/local/bin/elementsd
PrivateTmp=true
TimeoutStopSec=1200s
TimeoutStartSec=5s
# Fail when 10 tries within 1 minute fail (never)
StartLimitInterval=60s
StartLimitBurst=10
# Limit attempts to 1 per 10 seconds
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
2.
Check user and group (if the user doesn't exist, create it using useradd -m liquid1
).
3.
Run:
systemctl daemon-reload
4.
Place your elements config file in /home/liquid1/.elements/elements.conf
and configure the right values to connect to bitcoind (or set validatepegin=0
instead). Also, you will need to set daemon=0.
5.
To set up the service to start on boot up (and also execute it now), run:
systemctl enable --now elementsd
6.
You can check that the service is running correctly by running:
journalctl -efu elementsd