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 ?
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI 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 ?
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
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