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