diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-09-16 11:05:18 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-09-16 11:05:38 +0200 |
commit | 2d782ab2ce30bf106e34cd3288c9082ac04022f9 (patch) | |
tree | 8c9546e42f479644b0afc075772a7dffdcf281ac /contrib/init/bitcoind.conf | |
parent | edb1eebabccc1b05ae6cc8065eda53a36cdca3ad (diff) | |
parent | 234bfbf6a5fcba37e510e9cb6c1f2a629cd0290e (diff) |
Merge pull request #4611
234bfbf Add init scripts and docs for Upstart and OpenRC (Adam Weiss)
Diffstat (limited to 'contrib/init/bitcoind.conf')
-rw-r--r-- | contrib/init/bitcoind.conf | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/contrib/init/bitcoind.conf b/contrib/init/bitcoind.conf new file mode 100644 index 0000000000..f9554eecde --- /dev/null +++ b/contrib/init/bitcoind.conf @@ -0,0 +1,65 @@ +description "Bitcoin Core Daemon" + +start on runlevel [2345] +stop on starting rc RUNLEVEL=[016] + +env BITCOIND_BIN="/usr/bin/bitcoind" +env BITCOIND_USER="bitcoin" +env BITCOIND_GROUP="bitcoin" +env BITCOIND_PIDDIR="/var/run/bitcoind" +# upstart can't handle variables constructed with other variables +env BITCOIND_PIDFILE="/var/run/bitcoind/bitcoind.pid" +env BITCOIND_CONFIGFILE="/etc/bitcoin/bitcoin.conf" +env BITCOIND_DATADIR="/var/lib/bitcoind" + +expect fork + +respawn +respawn limit 5 120 +kill timeout 60 + +pre-start script + # this will catch non-existent config files + # bitcoind will check and exit with this very warning, but it can do so + # long after forking, leaving upstart to think everything started fine. + # since this is a commonly encountered case on install, just check and + # warn here. + if ! grep -qs '^rpcpassword=' "$BITCOIND_CONFIGFILE" ; then + echo "ERROR: You must set a secure rpcpassword to run bitcoind." + echo "The setting must appear in $BITCOIND_CONFIGFILE" + echo + echo "This password is security critical to securing wallets " + echo "and must not be the same as the rpcuser setting." + echo "You can generate a suitable random password using the following" + echo "command from the shell:" + echo + echo "bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'" + echo + echo "It is also recommended that you also set alertnotify so you are " + echo "notified of problems:" + echo + echo "ie: alertnotify=echo %%s | mail -s \"Bitcoin Alert\"" \ + "admin@foo.com" + echo + exit 1 + fi + + mkdir -p "$BITCOIND_PIDDIR" + chmod 0755 "$BITCOIND_PIDDIR" + chown $BITCOIND_USER:$BITCOIND_GROUP "$BITCOIND_PIDDIR" + chown $BITCOIND_USER:$BITCOIND_GROUP "$BITCOIND_CONFIGFILE" + chmod 0660 "$BITCOIND_CONFIGFILE" +end script + +exec start-stop-daemon \ + --start \ + --pidfile "$BITCOIND_PIDFILE" \ + --chuid $BITCOIND_USER:$BITCOIND_GROUP \ + --exec "$BITCOIND_BIN" \ + -- \ + -pid="$BITCOIND_PIDFILE" \ + -conf="$BITCOIND_CONFIGFILE" \ + -datadir="$BITCOIND_DATADIR" \ + -disablewallet \ + -daemon + |