Browse Source

update system scripts

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

68
contrib/init/hushd.openrc

@ -2,41 +2,41 @@
# backward compatibility for existing gentoo layout
#
if [ -d "/var/lib/bitcoin/.bitcoin" ]; then
BITCOIND_DEFAULT_DATADIR="/var/lib/bitcoin/.bitcoin"
if [ -d "/var/lib/hush/.hush" ]; then
HUSHD_DEFAULT_DATADIR="/var/lib/hush/.hush"
else
BITCOIND_DEFAULT_DATADIR="/var/lib/bitcoind"
HUSHD_DEFAULT_DATADIR="/var/lib/hushd"
fi
BITCOIND_CONFIGFILE=${BITCOIND_CONFIGFILE:-/etc/bitcoin/bitcoin.conf}
BITCOIND_PIDDIR=${BITCOIND_PIDDIR:-/var/run/bitcoind}
BITCOIND_PIDFILE=${BITCOIND_PIDFILE:-${BITCOIND_PIDDIR}/bitcoind.pid}
BITCOIND_DATADIR=${BITCOIND_DATADIR:-${BITCOIND_DEFAULT_DATADIR}}
BITCOIND_USER=${BITCOIND_USER:-${BITCOIN_USER:-bitcoin}}
BITCOIND_GROUP=${BITCOIND_GROUP:-bitcoin}
BITCOIND_BIN=${BITCOIND_BIN:-/usr/bin/bitcoind}
BITCOIND_NICE=${BITCOIND_NICE:-${NICELEVEL:-0}}
BITCOIND_OPTS="${BITCOIND_OPTS:-${BITCOIN_OPTS}}"
HUSHD_CONFIGFILE=${HUSHD_CONFIGFILE:-/etc/hush/hush.conf}
HUSHD_PIDDIR=${HUSHD_PIDDIR:-/var/run/hushd}
HUSHD_PIDFILE=${HUSHD_PIDFILE:-${HUSHD_PIDDIR}/hushd.pid}
HUSHD_DATADIR=${HUSHD_DATADIR:-${HUSHD_DEFAULT_DATADIR}}
HUSHD_USER=${HUSHD_USER:-${HUSH_USER:-hush}}
HUSHD_GROUP=${HUSHD_GROUP:-hush}
HUSHD_BIN=${HUSHD_BIN:-/usr/bin/hushd}
HUSHD_NICE=${HUSHD_NICE:-${NICELEVEL:-0}}
HUSHD_OPTS="${HUSHD_OPTS:-${HUSH_OPTS}}"
name="Bitcoin Core Daemon"
description="Bitcoin cryptocurrency P2P network daemon"
name="Hush Full Node Daemon"
description="Hush cryptocurrency P2P network daemon"
command="/usr/bin/bitcoind"
command_args="-pid=\"${BITCOIND_PIDFILE}\" \
-conf=\"${BITCOIND_CONFIGFILE}\" \
-datadir=\"${BITCOIND_DATADIR}\" \
command="/usr/bin/hushd"
command_args="-pid=\"${HUSHD_PIDFILE}\" \
-conf=\"${HUSHD_CONFIGFILE}\" \
-datadir=\"${HUSHD_DATADIR}\" \
-daemon \
${BITCOIND_OPTS}"
${HUSHD_OPTS}"
required_files="${BITCOIND_CONFIGFILE}"
start_stop_daemon_args="-u ${BITCOIND_USER} \
-N ${BITCOIND_NICE} -w 2000"
pidfile="${BITCOIND_PIDFILE}"
required_files="${HUSHD_CONFIGFILE}"
start_stop_daemon_args="-u ${HUSHD_USER} \
-N ${HUSHD_NICE} -w 2000"
pidfile="${HUSHD_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="${BITCOIND_SIGTERM_TIMEOUT}"
retry="${HUSHD_SIGTERM_TIMEOUT}"
depend() {
need localmount net
@ -50,29 +50,29 @@ start_pre() {
checkpath \
-d \
--mode 0750 \
--owner "${BITCOIND_USER}:${BITCOIND_GROUP}" \
"${BITCOIND_DATADIR}"
--owner "${HUSHD_USER}:${HUSHD_GROUP}" \
"${HUSHD_DATADIR}"
checkpath \
-d \
--mode 0755 \
--owner "${BITCOIND_USER}:${BITCOIND_GROUP}" \
"${BITCOIND_PIDDIR}"
--owner "${HUSHD_USER}:${HUSHD_GROUP}" \
"${HUSHD_PIDDIR}"
checkpath -f \
-o ${BITCOIND_USER}:${BITCOIND_GROUP} \
-o ${HUSHD_USER}:${HUSHD_GROUP} \
-m 0660 \
${BITCOIND_CONFIGFILE}
${HUSHD_CONFIGFILE}
checkconfig || return 1
}
checkconfig()
{
if ! grep -qs '^rpcpassword=' "${BITCOIND_CONFIGFILE}" ; then
if ! grep -qs '^rpcpassword=' "${HUSHD_CONFIGFILE}" ; then
eerror ""
eerror "ERROR: You must set a secure rpcpassword to run bitcoind."
eerror "The setting must appear in ${BITCOIND_CONFIGFILE}"
eerror "ERROR: You must set a secure rpcpassword to run hushd."
eerror "The setting must appear in ${HUSHD_CONFIGFILE}"
eerror ""
eerror "This password is security critical to securing wallets "
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 "notified of problems:"
eerror ""
eerror "ie: alertnotify=echo %%s | mail -s \"Bitcoin Alert\"" \
eerror "ie: alertnotify=echo %%s | mail -s \"Hush Alert\"" \
"admin@foo.com"
eerror ""
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
#BITCOIND_CONFIGFILE="/etc/bitcoin/bitcoin.conf"
#HUSHD_CONFIGFILE="/etc/hush/hush.conf"
# What directory to write pidfile to? (created and owned by $BITCOIND_USER)
#BITCOIND_PIDDIR="/var/run/bitcoind"
# What directory to write pidfile to? (created and owned by $HUSHD_USER)
#HUSHD_PIDDIR="/var/run/hushd"
# 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)
#BITCOIND_DATADIR="/var/lib/bitcoind"
# Where to write hushd data (be mindful that the blockchain is large)
#HUSHD_DATADIR="/var/lib/hushd"
# User and group to own bitcoind process
#BITCOIND_USER="bitcoin"
#BITCOIND_GROUP="bitcoin"
# User and group to own hushd process
#HUSHD_USER="hush"
#HUSHD_GROUP="hush"
# Path to bitcoind executable
#BITCOIND_BIN="/usr/bin/bitcoind"
# Path to hushd executable
#HUSHD_BIN="/usr/bin/hushd"
# Nice value to run bitcoind under
#BITCOIND_NICE=0
# Nice value to run hushd under
#HUSHD_NICE=0
# 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.
# Note that this will be mapped as argument to start-stop-daemon's
# '--retry' option, which means you can specify a retry schedule
# 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]
Description=Bitcoin's distributed currency daemon
Description=Hush: Speak And Transact Freely
After=network.target
[Service]
User=bitcoin
Group=bitcoin
User=hush
Group=hush
Type=forking
PIDFile=/var/lib/bitcoind/bitcoind.pid
ExecStart=/usr/bin/bitcoind -daemon -pid=/var/lib/bitcoind/bitcoind.pid \
-conf=/etc/bitcoin/bitcoin.conf -datadir=/var/lib/bitcoind -disablewallet
PIDFile=/var/lib/hushd/hushd.pid
ExecStart=/usr/bin/hushd -daemon -pid=/var/lib/hushd/hushd.pid \
-conf=/etc/hush/hush.conf -datadir=/var/lib/hushd -disablewallet
Restart=always
PrivateTmp=true

Loading…
Cancel
Save