Files
Casinotest/contrib/casinocoind.conf
Ubuntu Admin 9fceb7451e Upstart script
2015-12-04 17:27:04 +01:00

64 lines
2.2 KiB
Plaintext

description "Casinocoin Core Daemon"
start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]
env CASINOCOIND_BIN="/usr/bin/casinocoind"
env CASINOCOIND_USER="ubuntu"
env CASINOCOIND_GROUP="ubuntu"
env CASINOCOIND_PIDDIR="/var/run/casinocoind"
# upstart can't handle variables constructed with other variables
env CASINOCOIND_PIDFILE="/var/run/casinocoind/casinocoind.pid"
env CASINOCOIND_CONFIGFILE="/u01/CSC/.casinocoin/casinocoin.conf"
env CASINOCOIND_DATADIR="/u01/CSC/data"
expect fork
respawn
respawn limit 5 120
kill timeout 60
pre-start script
# this will catch non-existent config files
# bitcoind 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=' "$CASINOCOIND_CONFIGFILE" ; then
echo "ERROR: You must set a secure rpcpassword to run casinocoind."
echo "The setting must appear in $CASINOCOIND_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 \"Casinocoin Alert\"" \
"admin@foo.com"
echo
exit 1
fi
mkdir -p "$CASINOCOIND_PIDDIR"
chmod 0755 "$CASINOCOIND_PIDDIR"
chown $CASINOCOIND_USER:$CASINOCOIND_GROUP "$CASINOCOIND_PIDDIR"
chown $CASINOCOIND_USER:$CASINOCOIND_GROUP "$CASINOCOIND_CONFIGFILE"
chmod 0660 "$CASINOCOIND_CONFIGFILE"
end script
exec start-stop-daemon \
--start \
--pidfile "$CASINOCOIND_PIDFILE" \
--chuid $CASINOCOIND_USER:$CASINOCOIND_GROUP \
--exec "$CASINOCOIND_BIN" \
-- \
-pid="$CASINOCOIND_PIDFILE" \
-conf="$CASINOCOIND_CONFIGFILE" \
-datadir="$CASINOCOIND_DATADIR" \
-daemon