1

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 ?

2
  • 1
    There’s a suitable systemd configuration for bitcoind in the contrib directory.
    – Claris
    Nov 23, 2019 at 20:22
  • 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. Aug 20, 2020 at 8:49

2 Answers 2

2

To start bitcoind at startup on a system using systemd, use the service configuration provided in contrib/init/ 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
-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
2
  • 1
    That’s awful. There’s a @reboot flag for cron if you want to be hacky.
    – Claris
    Nov 24, 2019 at 17:39
  • 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
    Nov 25, 2019 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.