Skip to content

Instantly share code, notes, and snippets.

@MrChrisJ
Last active March 14, 2016 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrChrisJ/50e26466d5f2b186c216 to your computer and use it in GitHub Desktop.
Save MrChrisJ/50e26466d5f2b186c216 to your computer and use it in GitHub Desktop.
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
Copy link

oktoshi 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