Vexta/contrib/init/vextad.conf

65 lines
2 KiB
Text

description "Vexta Core Daemon"
start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]
env VEXTAD_BIN="/usr/bin/vextad"
env VEXTAD_USER="vexta"
env VEXTAD_GROUP="vexta"
env VEXTAD_PIDDIR="/var/run/vextad"
# upstart can't handle variables constructed with other variables
env VEXTAD_PIDFILE="/var/run/vextad/vextad.pid"
env VEXTAD_CONFIGFILE="/etc/vexta/vexta.conf"
env VEXTAD_DATADIR="/var/lib/vextad"
expect fork
respawn
respawn limit 5 120
kill timeout 600
pre-start script
# this will catch non-existent config files
# vextad 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=' "$VEXTAD_CONFIGFILE" ; then
echo "ERROR: You must set a secure rpcpassword to run vextad."
echo "The setting must appear in $VEXTAD_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 \"Vexta Alert\"" \
"admin@foo.com"
echo
exit 1
fi
mkdir -p "$VEXTAD_PIDDIR"
chmod 0755 "$VEXTAD_PIDDIR"
chown $VEXTAD_USER:$VEXTAD_GROUP "$VEXTAD_PIDDIR"
chown $VEXTAD_USER:$VEXTAD_GROUP "$VEXTAD_CONFIGFILE"
chmod 0660 "$VEXTAD_CONFIGFILE"
end script
exec start-stop-daemon \
--start \
--pidfile "$VEXTAD_PIDFILE" \
--chuid $VEXTAD_USER:$VEXTAD_GROUP \
--exec "$VEXTAD_BIN" \
-- \
-pid="$VEXTAD_PIDFILE" \
-conf="$VEXTAD_CONFIGFILE" \
-datadir="$VEXTAD_DATADIR" \
-disablewallet \
-daemon