bitcoind.conf raw

   1  description "Bitcoin Core Daemon"
   2  
   3  start on runlevel [2345]
   4  stop on starting rc RUNLEVEL=[016]
   5  
   6  env BITCOIND_BIN="/usr/bin/bitcoind"
   7  env BITCOIND_USER="bitcoin"
   8  env BITCOIND_GROUP="bitcoin"
   9  env BITCOIND_PIDDIR="/var/run/bitcoind"
  10  # upstart can't handle variables constructed with other variables
  11  env BITCOIND_PIDFILE="/var/run/bitcoind/bitcoind.pid"
  12  env BITCOIND_CONFIGFILE="/etc/bitcoin/bitcoin.conf"
  13  env BITCOIND_DATADIR="/var/lib/bitcoind"
  14  
  15  expect fork
  16  
  17  respawn
  18  respawn limit 5 120
  19  kill timeout 600
  20  
  21  pre-start script
  22      # this will catch non-existent config files
  23      # bitcoind will check and exit with this very warning, but it can do so
  24      # long after forking, leaving upstart to think everything started fine.
  25      # since this is a commonly encountered case on install, just check and
  26      # warn here.
  27      if ! grep -qs '^rpcpassword=' "$BITCOIND_CONFIGFILE" ; then
  28          echo "ERROR: You must set a secure rpcpassword to run bitcoind."
  29          echo "The setting must appear in $BITCOIND_CONFIGFILE"
  30          echo
  31          echo "This password is security critical to securing wallets "
  32          echo "and must not be the same as the rpcuser setting."
  33          echo "You can generate a suitable random password using the following "
  34          echo "command from the shell:"
  35          echo
  36          echo "bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'"
  37          echo
  38          echo "It is recommended that you also set alertnotify so you are "
  39          echo "notified of problems:"
  40          echo
  41          echo "ie: alertnotify=echo %%s | mail -s \"Bitcoin Alert\"" \
  42              "admin@foo.com"
  43          echo
  44          exit 1
  45      fi
  46  
  47      mkdir -p "$BITCOIND_PIDDIR"
  48      chmod 0755 "$BITCOIND_PIDDIR"
  49      chown $BITCOIND_USER:$BITCOIND_GROUP "$BITCOIND_PIDDIR"
  50      chown $BITCOIND_USER:$BITCOIND_GROUP "$BITCOIND_CONFIGFILE"
  51      chmod 0660 "$BITCOIND_CONFIGFILE"
  52  end script
  53  
  54  exec start-stop-daemon \
  55      --start \
  56      --pidfile "$BITCOIND_PIDFILE" \
  57      --chuid $BITCOIND_USER:$BITCOIND_GROUP \
  58      --exec "$BITCOIND_BIN" \
  59      -- \
  60      -pid="$BITCOIND_PIDFILE" \
  61      -conf="$BITCOIND_CONFIGFILE" \
  62      -datadir="$BITCOIND_DATADIR" \
  63      -disablewallet \
  64      -daemon
  65  
  66