aboutsummaryrefslogtreecommitdiff
path: root/contrib/init/dogecoind.conf
blob: 922f1ac838be33f256474b2da7b727cfcff8e3d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
description "Discoin Core Daemon"

start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]

env DISCOIND_BIN="/usr/bin/discoind"
env DISCOIND_USER="discoin"
env DISCOIND_GROUP="discoin"
env DISCOIND_PIDDIR="/var/run/discoind"
# upstart can't handle variables constructed with other variables
env DISCOIND_PIDFILE="/var/run/discoind/discoind.pid"
env DISCOIND_CONFIGFILE="/etc/discoin/discoin.conf"
env DISCOIND_DATADIR="/var/lib/discoind"

expect fork

respawn
respawn limit 5 120
kill timeout 60

pre-start script
    # this will catch non-existent config files
    # discoind 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=' "$DISCOIND_CONFIGFILE" ; then
        echo "ERROR: You must set a secure rpcpassword to run discoind."
        echo "The setting must appear in $DISCOIND_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 \"Discoin Alert\"" \
            "[email protected]"
        echo
        exit 1
    fi

    mkdir -p "$DISCOIND_PIDDIR"
    chmod 0755 "$DISCOIND_PIDDIR"
    chown $DISCOIND_USER:$DISCOIND_GROUP "$DISCOIND_PIDDIR"
    chown $DISCOIND_USER:$DISCOIND_GROUP "$DISCOIND_CONFIGFILE"
    chmod 0660 "$DISCOIND_CONFIGFILE"
end script

exec start-stop-daemon \
    --start \
    --pidfile "$DISCOIND_PIDFILE" \
    --chuid $DISCOIND_USER:$DISCOIND_GROUP \
    --exec "$DISCOIND_BIN" \
    -- \
    -pid="$DISCOIND_PIDFILE" \
    -conf="$DISCOIND_CONFIGFILE" \
    -datadir="$DISCOIND_DATADIR" \
    -disablewallet \
    -daemon