dash/contrib/init/dashd.conf
Wladimir J. van der Laan cca430ba9a
Merge #16569: Increase init file stop timeout
7fb7acfc206b4bf8c296d72b66f3bd4fe342fd87 Set init stop timeout to 10 min (setpill)

Pull request description:

  `bitcoind` can take a long time to flush its db cache to disk upon
  shutdown. Systemd sends a `SIGKILL` after a timeout, causing unclean
  shutdowns and triggering a long "Rolling forward" at the next startup.
  Disabling the timeout should prevent this from happening, and does not
  break systemd's `restart` logic.

  Addresses #13736.

ACKs for top commit:
  instagibbs:
    utACK 7fb7acfc20

Tree-SHA512: 16e0ce5a9ecf0628f8d93d68db3f5a78ab36021d9bede05a90c84f144db2e87e17707a6eb910cb7c018c265ce2c81d43de2988bd79e4a2d8554515db8fb5aa36
2022-04-02 16:30:52 +05:30

66 lines
2.1 KiB
Plaintext

description "Dash Core Daemon"
start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]
env BITCOIND_BIN="/usr/bin/dashd"
env BITCOIND_USER="dashcore"
env BITCOIND_GROUP="dashcore"
env BITCOIND_PIDDIR="/var/run/dashd"
# upstart can't handle variables constructed with other variables
env BITCOIND_PIDFILE="/var/run/dashd/dashd.pid"
env BITCOIND_CONFIGFILE="/etc/dashcore/dash.conf"
env BITCOIND_DATADIR="/var/lib/dashd"
expect fork
respawn
respawn limit 5 120
kill timeout 600
pre-start script
# this will catch non-existent config files
# dashd 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 dashd."
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 recommended that you also set alertnotify so you are "
echo "notified of problems:"
echo
echo "ie: alertnotify=echo %%s | mail -s \"Dash Core 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