You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bitcoind.conf 2.1KB

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