3 # backward compatibility for existing gentoo layout
5 if [ -d "/var/lib/bitcoin/.bitcoin" ]; then
6 BITCOIND_DEFAULT_DATADIR="/var/lib/bitcoin/.bitcoin"
8 BITCOIND_DEFAULT_DATADIR="/var/lib/bitcoind"
11 BITCOIND_CONFIGFILE=${BITCOIND_CONFIGFILE:-/etc/bitcoin/bitcoin.conf}
12 BITCOIND_PIDDIR=${BITCOIND_PIDDIR:-/var/run/bitcoind}
13 BITCOIND_PIDFILE=${BITCOIND_PIDFILE:-${BITCOIND_PIDDIR}/bitcoind.pid}
14 BITCOIND_DATADIR=${BITCOIND_DATADIR:-${BITCOIND_DEFAULT_DATADIR}}
15 BITCOIND_USER=${BITCOIND_USER:-${BITCOIN_USER:-bitcoin}}
16 BITCOIND_GROUP=${BITCOIND_GROUP:-bitcoin}
17 BITCOIND_BIN=${BITCOIND_BIN:-/usr/bin/bitcoind}
18 BITCOIND_NICE=${BITCOIND_NICE:-${NICELEVEL:-0}}
19 BITCOIND_OPTS="${BITCOIND_OPTS:-${BITCOIN_OPTS}}"
21 name="Bitcoin Core Daemon"
22 description="Bitcoin crypto-currency p2p network daemon"
24 command="/usr/bin/bitcoind"
25 command_args="-pid=\"${BITCOIND_PIDFILE}\" \
26 -conf=\"${BITCOIND_CONFIGFILE}\" \
27 -datadir=\"${BITCOIND_DATADIR}\" \
31 required_files="${BITCOIND_CONFIGFILE}"
32 start_stop_daemon_args="-u ${BITCOIND_USER} \
33 -N ${BITCOIND_NICE} -w 2000"
34 pidfile="${BITCOIND_PIDFILE}"
42 # 1) that the datadir exists and is writable (or create it)
43 # 2) that a directory for the pid exists and is writable
44 # 3) ownership and permissions on the config file
49 --owner "${BITCOIND_USER}:${BITCOIND_GROUP}" \
55 --owner "${BITCOIND_USER}:${BITCOIND_GROUP}" \
59 -o ${BITCOIND_USER}:${BITCOIND_GROUP} \
61 ${BITCOIND_CONFIGFILE}
63 checkconfig || return 1
68 if ! grep -qs '^rpcpassword=' "${BITCOIND_CONFIGFILE}" ; then
70 eerror "ERROR: You must set a secure rpcpassword to run bitcoind."
71 eerror "The setting must appear in ${BITCOIND_CONFIGFILE}"
73 eerror "This password is security critical to securing wallets "
74 eerror "and must not be the same as the rpcuser setting."
75 eerror "You can generate a suitable random password using the following"
76 eerror "command from the shell:"
78 eerror "bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'"
80 eerror "It is also recommended that you also set alertnotify so you are "
81 eerror "notified of problems:"
83 eerror "ie: alertnotify=echo %%s | mail -s \"Bitcoin Alert\"" \