Browse Source

update system scripts

minor
Duke Leto 4 years ago
parent
commit
edcc2aec82
  1. 28
      contrib/init/hushd.init
  2. 68
      contrib/init/hushd.openrc
  3. 34
      contrib/init/hushd.openrcconf
  4. 12
      contrib/init/hushd.service

28
contrib/init/hushd.init

@ -1,36 +1,36 @@
#!/bin/bash #!/bin/bash
# #
# bitcoind The bitcoin core server. # hushd The hush core server.
# #
# #
# chkconfig: 345 80 20 # chkconfig: 345 80 20
# description: bitcoind # description: hushd
# processname: bitcoind # processname: hushd
# #
# Source function library. # Source function library.
. /etc/init.d/functions . /etc/init.d/functions
# you can override defaults in /etc/sysconfig/bitcoind, see below # you can override defaults in /etc/sysconfig/hushd, see below
if [ -f /etc/sysconfig/bitcoind ]; then if [ -f /etc/sysconfig/hushd ]; then
. /etc/sysconfig/bitcoind . /etc/sysconfig/hushd
fi fi
RETVAL=0 RETVAL=0
prog=bitcoind prog=hushd
# you can override the lockfile via BITCOIND_LOCKFILE in /etc/sysconfig/bitcoind # you can override the lockfile via HUSHD_LOCKFILE in /etc/sysconfig/hushd
lockfile=${BITCOIND_LOCKFILE-/var/lock/subsys/bitcoind} lockfile=${HUSHD_LOCKFILE-/var/lock/subsys/hushd}
# bitcoind defaults to /usr/bin/bitcoind, override with BITCOIND_BIN # hushd defaults to /usr/bin/hushd, override with HUSHD_BIN
bitcoind=${BITCOIND_BIN-/usr/bin/bitcoind} hushd=${HUSHD_BIN-/usr/bin/hushd}
# bitcoind opts default to -disablewallet, override with BITCOIND_OPTS # hushd opts default to -disablewallet, override with HUSHD_OPTS
bitcoind_opts=${BITCOIND_OPTS--disablewallet} hushd_opts=${HUSHD_OPTS--disablewallet}
start() { start() {
echo -n $"Starting $prog: " echo -n $"Starting $prog: "
daemon $DAEMONOPTS $bitcoind $bitcoind_opts daemon $DAEMONOPTS $hushd $hushd_opts
RETVAL=$? RETVAL=$?
echo echo
[ $RETVAL -eq 0 ] && touch $lockfile [ $RETVAL -eq 0 ] && touch $lockfile

68
contrib/init/hushd.openrc

@ -2,41 +2,41 @@
# backward compatibility for existing gentoo layout # backward compatibility for existing gentoo layout
# #
if [ -d "/var/lib/bitcoin/.bitcoin" ]; then if [ -d "/var/lib/hush/.hush" ]; then
BITCOIND_DEFAULT_DATADIR="/var/lib/bitcoin/.bitcoin" HUSHD_DEFAULT_DATADIR="/var/lib/hush/.hush"
else else
BITCOIND_DEFAULT_DATADIR="/var/lib/bitcoind" HUSHD_DEFAULT_DATADIR="/var/lib/hushd"
fi fi
BITCOIND_CONFIGFILE=${BITCOIND_CONFIGFILE:-/etc/bitcoin/bitcoin.conf} HUSHD_CONFIGFILE=${HUSHD_CONFIGFILE:-/etc/hush/hush.conf}
BITCOIND_PIDDIR=${BITCOIND_PIDDIR:-/var/run/bitcoind} HUSHD_PIDDIR=${HUSHD_PIDDIR:-/var/run/hushd}
BITCOIND_PIDFILE=${BITCOIND_PIDFILE:-${BITCOIND_PIDDIR}/bitcoind.pid} HUSHD_PIDFILE=${HUSHD_PIDFILE:-${HUSHD_PIDDIR}/hushd.pid}
BITCOIND_DATADIR=${BITCOIND_DATADIR:-${BITCOIND_DEFAULT_DATADIR}} HUSHD_DATADIR=${HUSHD_DATADIR:-${HUSHD_DEFAULT_DATADIR}}
BITCOIND_USER=${BITCOIND_USER:-${BITCOIN_USER:-bitcoin}} HUSHD_USER=${HUSHD_USER:-${HUSH_USER:-hush}}
BITCOIND_GROUP=${BITCOIND_GROUP:-bitcoin} HUSHD_GROUP=${HUSHD_GROUP:-hush}
BITCOIND_BIN=${BITCOIND_BIN:-/usr/bin/bitcoind} HUSHD_BIN=${HUSHD_BIN:-/usr/bin/hushd}
BITCOIND_NICE=${BITCOIND_NICE:-${NICELEVEL:-0}} HUSHD_NICE=${HUSHD_NICE:-${NICELEVEL:-0}}
BITCOIND_OPTS="${BITCOIND_OPTS:-${BITCOIN_OPTS}}" HUSHD_OPTS="${HUSHD_OPTS:-${HUSH_OPTS}}"
name="Bitcoin Core Daemon" name="Hush Full Node Daemon"
description="Bitcoin cryptocurrency P2P network daemon" description="Hush cryptocurrency P2P network daemon"
command="/usr/bin/bitcoind" command="/usr/bin/hushd"
command_args="-pid=\"${BITCOIND_PIDFILE}\" \ command_args="-pid=\"${HUSHD_PIDFILE}\" \
-conf=\"${BITCOIND_CONFIGFILE}\" \ -conf=\"${HUSHD_CONFIGFILE}\" \
-datadir=\"${BITCOIND_DATADIR}\" \ -datadir=\"${HUSHD_DATADIR}\" \
-daemon \ -daemon \
${BITCOIND_OPTS}" ${HUSHD_OPTS}"
required_files="${BITCOIND_CONFIGFILE}" required_files="${HUSHD_CONFIGFILE}"
start_stop_daemon_args="-u ${BITCOIND_USER} \ start_stop_daemon_args="-u ${HUSHD_USER} \
-N ${BITCOIND_NICE} -w 2000" -N ${HUSHD_NICE} -w 2000"
pidfile="${BITCOIND_PIDFILE}" pidfile="${HUSHD_PIDFILE}"
# The retry schedule to use when stopping the daemon. Could be either # The retry schedule to use when stopping the daemon. Could be either
# a timeout in seconds or multiple signal/timeout pairs (like # a timeout in seconds or multiple signal/timeout pairs (like
# "SIGKILL/180 SIGTERM/300") # "SIGKILL/180 SIGTERM/300")
retry="${BITCOIND_SIGTERM_TIMEOUT}" retry="${HUSHD_SIGTERM_TIMEOUT}"
depend() { depend() {
need localmount net need localmount net
@ -50,29 +50,29 @@ start_pre() {
checkpath \ checkpath \
-d \ -d \
--mode 0750 \ --mode 0750 \
--owner "${BITCOIND_USER}:${BITCOIND_GROUP}" \ --owner "${HUSHD_USER}:${HUSHD_GROUP}" \
"${BITCOIND_DATADIR}" "${HUSHD_DATADIR}"
checkpath \ checkpath \
-d \ -d \
--mode 0755 \ --mode 0755 \
--owner "${BITCOIND_USER}:${BITCOIND_GROUP}" \ --owner "${HUSHD_USER}:${HUSHD_GROUP}" \
"${BITCOIND_PIDDIR}" "${HUSHD_PIDDIR}"
checkpath -f \ checkpath -f \
-o ${BITCOIND_USER}:${BITCOIND_GROUP} \ -o ${HUSHD_USER}:${HUSHD_GROUP} \
-m 0660 \ -m 0660 \
${BITCOIND_CONFIGFILE} ${HUSHD_CONFIGFILE}
checkconfig || return 1 checkconfig || return 1
} }
checkconfig() checkconfig()
{ {
if ! grep -qs '^rpcpassword=' "${BITCOIND_CONFIGFILE}" ; then if ! grep -qs '^rpcpassword=' "${HUSHD_CONFIGFILE}" ; then
eerror "" eerror ""
eerror "ERROR: You must set a secure rpcpassword to run bitcoind." eerror "ERROR: You must set a secure rpcpassword to run hushd."
eerror "The setting must appear in ${BITCOIND_CONFIGFILE}" eerror "The setting must appear in ${HUSHD_CONFIGFILE}"
eerror "" eerror ""
eerror "This password is security critical to securing wallets " eerror "This password is security critical to securing wallets "
eerror "and must not be the same as the rpcuser setting." eerror "and must not be the same as the rpcuser setting."
@ -84,7 +84,7 @@ checkconfig()
eerror "It is also recommended that you also set alertnotify so you are " eerror "It is also recommended that you also set alertnotify so you are "
eerror "notified of problems:" eerror "notified of problems:"
eerror "" eerror ""
eerror "ie: alertnotify=echo %%s | mail -s \"Bitcoin Alert\"" \ eerror "ie: alertnotify=echo %%s | mail -s \"Hush Alert\"" \
"admin@foo.com" "admin@foo.com"
eerror "" eerror ""
return 1 return 1

34
contrib/init/hushd.openrcconf

@ -1,33 +1,33 @@
# /etc/conf.d/bitcoind: config file for /etc/init.d/bitcoind # /etc/conf.d/hushd: config file for /etc/init.d/hushd
# Config file location # Config file location
#BITCOIND_CONFIGFILE="/etc/bitcoin/bitcoin.conf" #HUSHD_CONFIGFILE="/etc/hush/hush.conf"
# What directory to write pidfile to? (created and owned by $BITCOIND_USER) # What directory to write pidfile to? (created and owned by $HUSHD_USER)
#BITCOIND_PIDDIR="/var/run/bitcoind" #HUSHD_PIDDIR="/var/run/hushd"
# What filename to give the pidfile # What filename to give the pidfile
#BITCOIND_PIDFILE="${BITCOIND_PIDDIR}/bitcoind.pid" #HUSHD_PIDFILE="${HUSHD_PIDDIR}/hushd.pid"
# Where to write bitcoind data (be mindful that the blockchain is large) # Where to write hushd data (be mindful that the blockchain is large)
#BITCOIND_DATADIR="/var/lib/bitcoind" #HUSHD_DATADIR="/var/lib/hushd"
# User and group to own bitcoind process # User and group to own hushd process
#BITCOIND_USER="bitcoin" #HUSHD_USER="hush"
#BITCOIND_GROUP="bitcoin" #HUSHD_GROUP="hush"
# Path to bitcoind executable # Path to hushd executable
#BITCOIND_BIN="/usr/bin/bitcoind" #HUSHD_BIN="/usr/bin/hushd"
# Nice value to run bitcoind under # Nice value to run hushd under
#BITCOIND_NICE=0 #HUSHD_NICE=0
# Additional options (avoid -conf and -datadir, use flags above) # Additional options (avoid -conf and -datadir, use flags above)
BITCOIND_OPTS="-disablewallet" HUSHD_OPTS="-disablewallet"
# The timeout in seconds OpenRC will wait for bitcoind to terminate # The timeout in seconds OpenRC will wait for hushd to terminate
# after a SIGTERM has been raised. # after a SIGTERM has been raised.
# Note that this will be mapped as argument to start-stop-daemon's # Note that this will be mapped as argument to start-stop-daemon's
# '--retry' option, which means you can specify a retry schedule # '--retry' option, which means you can specify a retry schedule
# here. For more information see man 8 start-stop-daemon. # here. For more information see man 8 start-stop-daemon.
BITCOIND_SIGTERM_TIMEOUT=60 HUSHD_SIGTERM_TIMEOUT=60

12
contrib/init/hushd.service

@ -1,15 +1,15 @@
[Unit] [Unit]
Description=Bitcoin's distributed currency daemon Description=Hush: Speak And Transact Freely
After=network.target After=network.target
[Service] [Service]
User=bitcoin User=hush
Group=bitcoin Group=hush
Type=forking Type=forking
PIDFile=/var/lib/bitcoind/bitcoind.pid PIDFile=/var/lib/hushd/hushd.pid
ExecStart=/usr/bin/bitcoind -daemon -pid=/var/lib/bitcoind/bitcoind.pid \ ExecStart=/usr/bin/hushd -daemon -pid=/var/lib/hushd/hushd.pid \
-conf=/etc/bitcoin/bitcoin.conf -datadir=/var/lib/bitcoind -disablewallet -conf=/etc/hush/hush.conf -datadir=/var/lib/hushd -disablewallet
Restart=always Restart=always
PrivateTmp=true PrivateTmp=true

Loading…
Cancel
Save