FreeBSD rc.d Scripts for Bitcoin and Litecoin

The Bitcoin and Litecoin ports don't include any rc.d start up and shutdown scripts for FreeBSD. So I went ahead and made some. In order to use these scripts you must do some additional work after installing the respective ports.

Updated versions of these scripts have been released!

http://www.unibia.com/unibianet/freebsd/freebsd-rcd-scripts-crypto-coins...

To access the old scripts you can use:
http://www.unibia.com/unibianet/sites/default/files/bitcoin_OLD.rc_.d
http://www.unibia.com/unibianet/sites/default/files/litecoin_OLD.rc_.d

This page will remain for historical purposes, it's recommended that you use the new scripts.


First create the database directory:

mkdir /var/db/bitcoin/
mkdir /var/db/litecoin/

Then create a configuration file and and the very least set a "rpcpassword":

edit /usr/local/etc/bitcoin.conf
edit /usr/local/etc/litecoin.conf

You can get a sample configuration file from

Now download the rc.d scripts, place them in "/usr/local/etc/rc.d" and set the correct permissions:

cd /usr/local/etc/rc.d
fetch -o /usr/local/etc/rc.d/bitcoin http://www.unibia.com/unibianet/sites/default/files/bitcoin.rc_.d
fetch -o /usr/local/etc/rc.d/litecoin http://www.unibia.com/unibianet/sites/default/files/litecoin.rc_.d
chmod 555 /usr/local/etc/rc.d/bitcoin
chmod 555 /usr/local/etc/rc.d/litecoin

Finally enable the service in /etc/rc.conf:

echo "bitcoin_enable="YES"" >> /etc/rc.conf
echo "litecoin_enable="YES"" >> /etc/rc.conf

Now you can start the service using:

service bitcoin start
service litecoin start

Stop them with:

service bitcoin stop
service litecoin stop

Securing Your Bitcoin and Litecoin Service

if you want to run Bitcoin or Litecoin as an alternate user you can follow this tip that was submitted to me for Bitcoin. Simply adjust the names and paths as needed:


Edit the rc-script and change the line that starts the daemon to look like this:

su bitcoin -c "/usr/local/bin/bitcoind -conf=/usr/local/etc/bitcoin.conf -datadir=/var/db/bitcoin/ -noupnp -daemon"

This assumes there is a user bitcoin, so make sure of that. This also needs the user bitcoin to have shell-access. So, make sure you set a ridiculous password (you won't ever need it anyway) and make sure you deny the user bitcoin any ssh-access. To do that, edit /etc/ssh/sshd_config and add the line

DenyUsers bitcoin 

If you found this useful and would like to show thanks, I like Bitcoins: 1B6eyXVRPxdEitW5vWrUnzzXUy6o38P9wN