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 cryptocurrency 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}"
36 # The retry schedule to use when stopping the daemon. Could be either
37 # a timeout in seconds or multiple signal/timeout pairs (like
38 # "SIGKILL/180 SIGTERM/300")
39 retry="${BITCOIND_SIGTERM_TIMEOUT}"
46 # 1) that the datadir exists and is writable (or create it)
47 # 2) that a directory for the pid exists and is writable
48 # 3) ownership and permissions on the config file
53 --owner "${BITCOIND_USER}:${BITCOIND_GROUP}" \
59 --owner "${BITCOIND_USER}:${BITCOIND_GROUP}" \
63 -o ${BITCOIND_USER}:${BITCOIND_GROUP} \
65 ${BITCOIND_CONFIGFILE}
67 checkconfig || return 1
72 if ! grep -qs '^rpcpassword=' "${BITCOIND_CONFIGFILE}" ; then
74 eerror "ERROR: You must set a secure rpcpassword to run bitcoind."
75 eerror "The setting must appear in ${BITCOIND_CONFIGFILE}"
77 eerror "This password is security critical to securing wallets "
78 eerror "and must not be the same as the rpcuser setting."
79 eerror "You can generate a suitable random password using the following "
80 eerror "command from the shell:"
82 eerror "bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'"
84 eerror "It is recommended that you also set alertnotify so you are "
85 eerror "notified of problems:"
87 eerror "ie: alertnotify=echo %%s | mail -s \"Bitcoin Alert\"" \