Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fullnode_Extras.md

Auto Restart Bitcoin Service

See original script here: https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service

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

Then enter the text in the file above. We are going to omit some of the arguments:

[Unit]
Description=Bitcoin's distributed currency daemon
After=network.target

[Service]
User=bitcoin
Group=bitcoin

Type=forking
PIDFile=/home/pi/.bitcoin/bitcoind.pid
ExecStart=/usr/bin/bitcoind -daemon -pid=/home/pi/.bitcoin/bitcoind.pid \

Restart=always
PrivateTmp=true
TimeoutStopSec=60s
TimeoutStartSec=2s
StartLimitInterval=120s
StartLimitBurst=5

[Install]
WantedBy=multi-user.target

Clean out the RAM every 24hours

To prevent your fullnode from crashing you can carry out the following script:

$ sudo apt-get install cron

then:

$ sudo crontab -e 

(this will open cron for edition)
and add this line at the end:

0 4 * * * root sync; echo 3 | sudo tee /proc/sys/vm/drop_caches

with thanks to OkToshi who raised this in Issue 4

@oktoshi

This comment has been minimized.

Copy link

commented Mar 14, 2016

For testing.

[Unit]
Description=Bitcoin Daemon
After=network.target

[Service]
User=bitcoin
Group=bitcoin
ExecStart=/usr/bin/bitcoind -daemon=0
-conf=/etc/bitcoin/bitcoin.conf
-datadir=/srv/bitcoin
-pid=/run/bitcoind.pid
ExecReload=/usr/bin/kill -HUP $MAINPID
ExecStop=/usr/bin/bitcoind stop

[Install]
WantedBy=multi-user.target

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.