v. 1.0.0.0
This commit is contained in:
12
contrib/init/README.md
Normal file
12
contrib/init/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
Sample configuration files for:
|
||||
|
||||
SystemD: neodashd.service
|
||||
Upstart: neodashd.conf
|
||||
OpenRC: neodashd.openrc
|
||||
neodashd.openrcconf
|
||||
CentOS: neodashd.init
|
||||
OS X: org.neodash.neodashd.plist
|
||||
|
||||
have been made available to assist packagers in creating node packages here.
|
||||
|
||||
See doc/init.md for more information.
|
||||
65
contrib/init/neodashd.conf
Normal file
65
contrib/init/neodashd.conf
Normal file
@@ -0,0 +1,65 @@
|
||||
description "Neodash Core Daemon"
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on starting rc RUNLEVEL=[016]
|
||||
|
||||
env BITCOIND_BIN="/usr/bin/neodashd"
|
||||
env BITCOIND_USER="neodash"
|
||||
env BITCOIND_GROUP="neodash"
|
||||
env BITCOIND_PIDDIR="/var/run/neodashd"
|
||||
# upstart can't handle variables constructed with other variables
|
||||
env BITCOIND_PIDFILE="/var/run/neodashd/neodashd.pid"
|
||||
env BITCOIND_CONFIGFILE="/etc/neodash/neodash.conf"
|
||||
env BITCOIND_DATADIR="/var/lib/neodashd"
|
||||
|
||||
expect fork
|
||||
|
||||
respawn
|
||||
respawn limit 5 120
|
||||
kill timeout 60
|
||||
|
||||
pre-start script
|
||||
# this will catch non-existent config files
|
||||
# neodashd 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=' "$BITCOIND_CONFIGFILE" ; then
|
||||
echo "ERROR: You must set a secure rpcpassword to run neodashd."
|
||||
echo "The setting must appear in $BITCOIND_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 \"Neodash Alert\"" \
|
||||
"admin@foo.com"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$BITCOIND_PIDDIR"
|
||||
chmod 0755 "$BITCOIND_PIDDIR"
|
||||
chown $BITCOIND_USER:$BITCOIND_GROUP "$BITCOIND_PIDDIR"
|
||||
chown $BITCOIND_USER:$BITCOIND_GROUP "$BITCOIND_CONFIGFILE"
|
||||
chmod 0660 "$BITCOIND_CONFIGFILE"
|
||||
end script
|
||||
|
||||
exec start-stop-daemon \
|
||||
--start \
|
||||
--pidfile "$BITCOIND_PIDFILE" \
|
||||
--chuid $BITCOIND_USER:$BITCOIND_GROUP \
|
||||
--exec "$BITCOIND_BIN" \
|
||||
-- \
|
||||
-pid="$BITCOIND_PIDFILE" \
|
||||
-conf="$BITCOIND_CONFIGFILE" \
|
||||
-datadir="$BITCOIND_DATADIR" \
|
||||
-disablewallet \
|
||||
-daemon
|
||||
|
||||
67
contrib/init/neodashd.init
Normal file
67
contrib/init/neodashd.init
Normal file
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# neodashd The neodash core server.
|
||||
#
|
||||
#
|
||||
# chkconfig: 345 80 20
|
||||
# description: neodashd
|
||||
# processname: neodashd
|
||||
#
|
||||
|
||||
# Source function library.
|
||||
. /etc/init.d/functions
|
||||
|
||||
# you can override defaults in /etc/sysconfig/neodashd, see below
|
||||
if [ -f /etc/sysconfig/neodashd ]; then
|
||||
. /etc/sysconfig/neodashd
|
||||
fi
|
||||
|
||||
RETVAL=0
|
||||
|
||||
prog=neodashd
|
||||
# you can override the lockfile via BITCOIND_LOCKFILE in /etc/sysconfig/neodashd
|
||||
lockfile=${BITCOIND_LOCKFILE-/var/lock/subsys/neodashd}
|
||||
|
||||
# neodashd defaults to /usr/bin/neodashd, override with BITCOIND_BIN
|
||||
neodashd=${BITCOIND_BIN-/usr/bin/neodashd}
|
||||
|
||||
# neodashd opts default to -disablewallet, override with BITCOIND_OPTS
|
||||
neodashd_opts=${BITCOIND_OPTS--disablewallet}
|
||||
|
||||
start() {
|
||||
echo -n $"Starting $prog: "
|
||||
daemon $DAEMONOPTS $neodashd $neodashd_opts
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch $lockfile
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
killproc $prog
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f $lockfile
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status $prog
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: service $prog {start|stop|status|restart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
92
contrib/init/neodashd.openrc
Normal file
92
contrib/init/neodashd.openrc
Normal file
@@ -0,0 +1,92 @@
|
||||
#!/sbin/runscript
|
||||
|
||||
# backward compatibility for existing gentoo layout
|
||||
#
|
||||
if [ -d "/var/lib/neodash/.neodash" ]; then
|
||||
BITCOIND_DEFAULT_DATADIR="/var/lib/neodash/.neodash"
|
||||
else
|
||||
BITCOIND_DEFAULT_DATADIR="/var/lib/neodashd"
|
||||
fi
|
||||
|
||||
BITCOIND_CONFIGFILE=${BITCOIND_CONFIGFILE:-/etc/neodash/neodash.conf}
|
||||
BITCOIND_PIDDIR=${BITCOIND_PIDDIR:-/var/run/neodashd}
|
||||
BITCOIND_PIDFILE=${BITCOIND_PIDFILE:-${BITCOIND_PIDDIR}/neodashd.pid}
|
||||
BITCOIND_DATADIR=${BITCOIND_DATADIR:-${BITCOIND_DEFAULT_DATADIR}}
|
||||
BITCOIND_USER=${BITCOIND_USER:-${BITCOIN_USER:-neodash}}
|
||||
BITCOIND_GROUP=${BITCOIND_GROUP:-neodash}
|
||||
BITCOIND_BIN=${BITCOIND_BIN:-/usr/bin/neodashd}
|
||||
BITCOIND_NICE=${BITCOIND_NICE:-${NICELEVEL:-0}}
|
||||
BITCOIND_OPTS="${BITCOIND_OPTS:-${BITCOIN_OPTS}}"
|
||||
|
||||
name="Neodash Core Daemon"
|
||||
description="Neodash cryptocurrency P2P network daemon"
|
||||
|
||||
command="/usr/bin/neodashd"
|
||||
command_args="-pid=\"${BITCOIND_PIDFILE}\" \
|
||||
-conf=\"${BITCOIND_CONFIGFILE}\" \
|
||||
-datadir=\"${BITCOIND_DATADIR}\" \
|
||||
-daemon \
|
||||
${BITCOIND_OPTS}"
|
||||
|
||||
required_files="${BITCOIND_CONFIGFILE}"
|
||||
start_stop_daemon_args="-u ${BITCOIND_USER} \
|
||||
-N ${BITCOIND_NICE} -w 2000"
|
||||
pidfile="${BITCOIND_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}"
|
||||
|
||||
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 "${BITCOIND_USER}:${BITCOIND_GROUP}" \
|
||||
"${BITCOIND_DATADIR}"
|
||||
|
||||
checkpath \
|
||||
-d \
|
||||
--mode 0755 \
|
||||
--owner "${BITCOIND_USER}:${BITCOIND_GROUP}" \
|
||||
"${BITCOIND_PIDDIR}"
|
||||
|
||||
checkpath -f \
|
||||
-o ${BITCOIND_USER}:${BITCOIND_GROUP} \
|
||||
-m 0660 \
|
||||
${BITCOIND_CONFIGFILE}
|
||||
|
||||
checkconfig || return 1
|
||||
}
|
||||
|
||||
checkconfig()
|
||||
{
|
||||
if ! grep -qs '^rpcpassword=' "${BITCOIND_CONFIGFILE}" ; then
|
||||
eerror ""
|
||||
eerror "ERROR: You must set a secure rpcpassword to run neodashd."
|
||||
eerror "The setting must appear in ${BITCOIND_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 \"Neodash Alert\"" \
|
||||
"admin@foo.com"
|
||||
eerror ""
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
33
contrib/init/neodashd.openrcconf
Normal file
33
contrib/init/neodashd.openrcconf
Normal file
@@ -0,0 +1,33 @@
|
||||
# /etc/conf.d/neodashd: config file for /etc/init.d/neodashd
|
||||
|
||||
# Config file location
|
||||
#BITCOIND_CONFIGFILE="/etc/neodash/neodash.conf"
|
||||
|
||||
# What directory to write pidfile to? (created and owned by $BITCOIND_USER)
|
||||
#BITCOIND_PIDDIR="/var/run/neodashd"
|
||||
|
||||
# What filename to give the pidfile
|
||||
#BITCOIND_PIDFILE="${BITCOIND_PIDDIR}/neodashd.pid"
|
||||
|
||||
# Where to write neodashd data (be mindful that the blockchain is large)
|
||||
#BITCOIND_DATADIR="/var/lib/neodashd"
|
||||
|
||||
# User and group to own neodashd process
|
||||
#BITCOIND_USER="neodash"
|
||||
#BITCOIND_GROUP="neodash"
|
||||
|
||||
# Path to neodashd executable
|
||||
#BITCOIND_BIN="/usr/bin/neodashd"
|
||||
|
||||
# Nice value to run neodashd under
|
||||
#BITCOIND_NICE=0
|
||||
|
||||
# Additional options (avoid -conf and -datadir, use flags above)
|
||||
BITCOIND_OPTS="-disablewallet"
|
||||
|
||||
# The timeout in seconds OpenRC will wait for bitcoind 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
|
||||
22
contrib/init/neodashd.service
Normal file
22
contrib/init/neodashd.service
Normal file
@@ -0,0 +1,22 @@
|
||||
[Unit]
|
||||
Description=Neodash's distributed currency daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=neodash
|
||||
Group=neodash
|
||||
|
||||
Type=forking
|
||||
PIDFile=/var/lib/neodashd/neodashd.pid
|
||||
ExecStart=/usr/bin/neodashd -daemon -pid=/var/lib/neodashd/neodashd.pid \
|
||||
-conf=/etc/neodash/neodash.conf -datadir=/var/lib/neodashd -disablewallet
|
||||
|
||||
Restart=always
|
||||
PrivateTmp=true
|
||||
TimeoutStopSec=60s
|
||||
TimeoutStartSec=2s
|
||||
StartLimitInterval=120s
|
||||
StartLimitBurst=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
15
contrib/init/org.neodash.neodashd.plist
Normal file
15
contrib/init/org.neodash.neodashd.plist
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>org.neodash.neodashd</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/usr/local/bin/neodashd</string>
|
||||
<string>-daemon</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
Reference in New Issue
Block a user