2014-07-31 17:56:17 +02:00
|
|
|
#!/sbin/runscript
|
|
|
|
|
|
|
|
# backward compatibility for existing gentoo layout
|
|
|
|
#
|
2024-12-16 19:40:22 +01:00
|
|
|
if [ -d "/var/lib/neobytes/.neobytes" ]; then
|
|
|
|
NEOBYTESD_DEFAULT_DATADIR="/var/lib/neobytes/.neobytes"
|
2014-07-31 17:56:17 +02:00
|
|
|
else
|
2024-12-16 19:40:22 +01:00
|
|
|
NEOBYTESD_DEFAULT_DATADIR="/var/lib/neobytesd"
|
2014-07-31 17:56:17 +02:00
|
|
|
fi
|
|
|
|
|
2024-12-16 19:40:22 +01:00
|
|
|
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}}"
|
2014-07-31 17:56:17 +02:00
|
|
|
|
2024-12-16 19:40:22 +01:00
|
|
|
name="Neobytes Core Daemon"
|
|
|
|
description="Neobytes cryptocurrency P2P network daemon"
|
2014-07-31 17:56:17 +02:00
|
|
|
|
2024-02-05 23:00:22 +01:00
|
|
|
command="/usr/bin/neobytesd"
|
2024-12-16 19:40:22 +01:00
|
|
|
command_args="-pid=\"${NEOBYTESD_PIDFILE}\" \
|
|
|
|
-conf=\"${NEOBYTESD_CONFIGFILE}\" \
|
|
|
|
-datadir=\"${NEOBYTESD_DATADIR}\" \
|
2014-07-31 17:56:17 +02:00
|
|
|
-daemon \
|
2024-12-16 19:40:22 +01:00
|
|
|
${NEOBYTESD_OPTS}"
|
2014-07-31 17:56:17 +02:00
|
|
|
|
2024-12-16 19:40:22 +01:00
|
|
|
required_files="${NEOBYTESD_CONFIGFILE}"
|
|
|
|
start_stop_daemon_args="-u ${NEOBYTESD_USER} \
|
|
|
|
-N ${NEOBYTESD_NICE} -w 2000"
|
|
|
|
pidfile="${NEOBYTESD_PIDFILE}"
|
2015-07-08 22:35:29 +02:00
|
|
|
|
|
|
|
# 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")
|
2024-12-16 19:40:22 +01:00
|
|
|
retry="${NEOBYTESD_SIGTERM_TIMEOUT}"
|
2014-07-31 17:56:17 +02:00
|
|
|
|
|
|
|
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 \
|
2024-12-16 19:40:22 +01:00
|
|
|
--owner "${NEOBYTESD_USER}:${NEOBYTESD_GROUP}" \
|
|
|
|
"${NEOBYTESD_DATADIR}"
|
2014-07-31 17:56:17 +02:00
|
|
|
|
|
|
|
checkpath \
|
|
|
|
-d \
|
|
|
|
--mode 0755 \
|
2024-12-16 19:40:22 +01:00
|
|
|
--owner "${NEOBYTESD_USER}:${NEOBYTESD_GROUP}" \
|
|
|
|
"${NEOBYTESD_PIDDIR}"
|
2014-07-31 17:56:17 +02:00
|
|
|
|
|
|
|
checkpath -f \
|
2024-12-16 19:40:22 +01:00
|
|
|
-o ${NEOBYTESD_USER}:${NEOBYTESD_GROUP} \
|
2014-07-31 17:56:17 +02:00
|
|
|
-m 0660 \
|
2024-12-16 19:40:22 +01:00
|
|
|
${NEOBYTESD_CONFIGFILE}
|
2014-07-31 17:56:17 +02:00
|
|
|
|
|
|
|
checkconfig || return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
checkconfig()
|
|
|
|
{
|
2024-12-16 19:40:22 +01:00
|
|
|
if ! grep -qs '^rpcpassword=' "${NEOBYTESD_CONFIGFILE}" ; then
|
2014-07-31 17:56:17 +02:00
|
|
|
eerror ""
|
2024-02-05 23:00:22 +01:00
|
|
|
eerror "ERROR: You must set a secure rpcpassword to run neobytesd."
|
2024-12-16 19:40:22 +01:00
|
|
|
eerror "The setting must appear in ${NEOBYTESD_CONFIGFILE}"
|
2014-07-31 17:56:17 +02:00
|
|
|
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 ""
|
2024-12-16 19:40:22 +01:00
|
|
|
eerror "ie: alertnotify=echo %%s | mail -s \"Neobytes Core Alert\"" \
|
2014-07-31 17:56:17 +02:00
|
|
|
"admin@foo.com"
|
|
|
|
eerror ""
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|