1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- description "Starwels Daemon"
-
- start on runlevel [2345]
- stop on starting rc RUNLEVEL=[016]
-
- env STARWELSD_BIN="/usr/bin/starwelsd"
- env STARWELSD_USER="starwels"
- env STARWELSD_GROUP="starwels"
- env STARWELSD_PIDDIR="/var/run/starwelsd"
- # upstart can't handle variables constructed with other variables
- env STARWELSD_PIDFILE="/var/run/starwelsd/starwelsd.pid"
- env STARWELSD_CONFIGFILE="/etc/starwels/starwels.conf"
- env STARWELSD_DATADIR="/var/lib/starwelsd"
-
- expect fork
-
- respawn
- respawn limit 5 120
- kill timeout 60
-
- pre-start script
- # this will catch non-existent config files
- # starwelsd 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=' "$STARWELSD_CONFIGFILE" ; then
- echo "ERROR: You must set a secure rpcpassword to run starwelsd."
- echo "The setting must appear in $STARWELSD_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 \"Starwels Alert\"" \
- "admin@foo.com"
- echo
- exit 1
- fi
-
- mkdir -p "$STARWELSD_PIDDIR"
- chmod 0755 "$STARWELSD_PIDDIR"
- chown $STARWELSD_USER:$STARWELSD_GROUP "$STARWELSD_PIDDIR"
- chown $STARWELSD_USER:$STARWELSD_GROUP "$STARWELSD_CONFIGFILE"
- chmod 0660 "$STARWELSD_CONFIGFILE"
- end script
-
- exec start-stop-daemon \
- --start \
- --pidfile "$STARWELSD_PIDFILE" \
- --chuid $STARWELSD_USER:$STARWELSD_GROUP \
- --exec "$STARWELSD_BIN" \
- -- \
- -pid="$STARWELSD_PIDFILE" \
- -conf="$STARWELSD_CONFIGFILE" \
- -datadir="$STARWELSD_DATADIR" \
- -disablewallet \
- -daemon
|