66 lines
2.2 KiB
Plaintext
66 lines
2.2 KiB
Plaintext
description "Neobytes Core Daemon"
|
|
|
|
start on runlevel [2345]
|
|
stop on starting rc RUNLEVEL=[016]
|
|
|
|
env NEOBYTESD_BIN="/usr/bin/neobytesd"
|
|
env NEOBYTESD_USER="neobytes"
|
|
env NEOBYTESD_GROUP="neobytes"
|
|
env NEOBYTESD_PIDDIR="/var/run/neobytesd"
|
|
# upstart can't handle variables constructed with other variables
|
|
env NEOBYTESD_PIDFILE="/var/run/neobytesd/neobytesd.pid"
|
|
env NEOBYTESD_CONFIGFILE="/etc/neobytes/neobytes.conf"
|
|
env NEOBYTESD_DATADIR="/var/lib/neobytesd"
|
|
|
|
expect fork
|
|
|
|
respawn
|
|
respawn limit 5 120
|
|
kill timeout 60
|
|
|
|
pre-start script
|
|
# this will catch non-existent config files
|
|
# neobytesd 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=' "$NEOBYTESD_CONFIGFILE" ; then
|
|
echo "ERROR: You must set a secure rpcpassword to run neobytesd."
|
|
echo "The setting must appear in $NEOBYTESD_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 \"Neobytes Core Alert\"" \
|
|
"admin@foo.com"
|
|
echo
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$NEOBYTESD_PIDDIR"
|
|
chmod 0755 "$NEOBYTESD_PIDDIR"
|
|
chown $NEOBYTESD_USER:$NEOBYTESD_GROUP "$NEOBYTESD_PIDDIR"
|
|
chown $NEOBYTESD_USER:$NEOBYTESD_GROUP "$NEOBYTESD_CONFIGFILE"
|
|
chmod 0660 "$NEOBYTESD_CONFIGFILE"
|
|
end script
|
|
|
|
exec start-stop-daemon \
|
|
--start \
|
|
--pidfile "$NEOBYTESD_PIDFILE" \
|
|
--chuid $NEOBYTESD_USER:$NEOBYTESD_GROUP \
|
|
--exec "$NEOBYTESD_BIN" \
|
|
-- \
|
|
-pid="$NEOBYTESD_PIDFILE" \
|
|
-conf="$NEOBYTESD_CONFIGFILE" \
|
|
-datadir="$NEOBYTESD_DATADIR" \
|
|
-disablewallet \
|
|
-daemon
|
|
|