#!/sbin/runscript # backward compatibility for existing gentoo layout # if [ -d "/var/lib/neobytes/.neobytes" ]; then NEOBYTESD_DEFAULT_DATADIR="/var/lib/neobytes/.neobytes" else NEOBYTESD_DEFAULT_DATADIR="/var/lib/neobytesd" fi NEOBYTESD_CONFIGFILE=${NEOBYTESD_CONFIGFILE:-/etc/neobytes/neobytes.conf} NEOBYTESD_PIDDIR=${NEOBYTESD_PIDDIR:-/var/run/neobytesd} NEOBYTESD_PIDFILE=${NEOBYTESD_PIDFILE:-${NEOBYTESD_PIDDIR}/neobytesd.pid} NEOBYTESD_DATADIR=${NEOBYTESD_DATADIR:-${NEOBYTESD_DEFAULT_DATADIR}} NEOBYTESD_USER=${NEOBYTESD_USER:-${NEOBYTES_USER:-neobytes}} NEOBYTESD_GROUP=${NEOBYTESD_GROUP:-neobytes} NEOBYTESD_BIN=${NEOBYTESD_BIN:-/usr/bin/neobytesd} NEOBYTESD_NICE=${NEOBYTESD_NICE:-${NICELEVEL:-0}} NEOBYTESD_OPTS="${NEOBYTESD_OPTS:-${NEOBYTES_OPTS}}" name="Neobytes Core Daemon" description="Neobytes cryptocurrency P2P network daemon" command="/usr/bin/neobytesd" command_args="-pid=\"${NEOBYTESD_PIDFILE}\" \ -conf=\"${NEOBYTESD_CONFIGFILE}\" \ -datadir=\"${NEOBYTESD_DATADIR}\" \ -daemon \ ${NEOBYTESD_OPTS}" required_files="${NEOBYTESD_CONFIGFILE}" start_stop_daemon_args="-u ${NEOBYTESD_USER} \ -N ${NEOBYTESD_NICE} -w 2000" pidfile="${NEOBYTESD_PIDFILE}" # The retry schedule to use when stopping the daemon. Could be either # a timeout in seconds or multiple signal/timeout pairs (like # "SIGKILL/180 SIGTERM/300") retry="${NEOBYTESD_SIGTERM_TIMEOUT}" depend() { need localmount net } # verify # 1) that the datadir exists and is writable (or create it) # 2) that a directory for the pid exists and is writable # 3) ownership and permissions on the config file start_pre() { checkpath \ -d \ --mode 0750 \ --owner "${NEOBYTESD_USER}:${NEOBYTESD_GROUP}" \ "${NEOBYTESD_DATADIR}" checkpath \ -d \ --mode 0755 \ --owner "${NEOBYTESD_USER}:${NEOBYTESD_GROUP}" \ "${NEOBYTESD_PIDDIR}" checkpath -f \ -o ${NEOBYTESD_USER}:${NEOBYTESD_GROUP} \ -m 0660 \ ${NEOBYTESD_CONFIGFILE} checkconfig || return 1 } checkconfig() { if ! grep -qs '^rpcpassword=' "${NEOBYTESD_CONFIGFILE}" ; then eerror "" eerror "ERROR: You must set a secure rpcpassword to run neobytesd." eerror "The setting must appear in ${NEOBYTESD_CONFIGFILE}" eerror "" eerror "This password is security critical to securing wallets " eerror "and must not be the same as the rpcuser setting." eerror "You can generate a suitable random password using the following" eerror "command from the shell:" eerror "" eerror "bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'" eerror "" eerror "It is also recommended that you also set alertnotify so you are " eerror "notified of problems:" eerror "" eerror "ie: alertnotify=echo %%s | mail -s \"Neobytes Core Alert\"" \ "admin@foo.com" eerror "" return 1 fi }