From eabc905baca0c119724b6505c7e76bedfb35f02b Mon Sep 17 00:00:00 2001 From: Bryce Lynch Date: Mon, 9 Dec 2013 14:24:54 -0800 Subject: [PATCH] Add Debian-style initscript * Add validators and validation_quorum from the v0.16 release notes. * We keep having to tell people to do this during integration, let's just make it the default. * Add comment about the log file location that states that it has to be absolute rather than relative after an integration troubleshoot earlier today. Signed-off-by: Bryce Lynch --- doc/rippled-example.cfg | 17 ++++++- doc/rippled.init | 101 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 doc/rippled.init diff --git a/doc/rippled-example.cfg b/doc/rippled-example.cfg index f618628f4..ec028d64b 100644 --- a/doc/rippled-example.cfg +++ b/doc/rippled-example.cfg @@ -748,11 +748,12 @@ medium # Note that HyperLevelDB is unavailable on Windows platforms -# [node_db] type=HyperLevelDB path=db/hyperldb +# This needs to be an absolute directory reference, not a relative one. +# Modify this value as required. [debug_logfile] log/debug.log @@ -772,3 +773,17 @@ pool.ntp.org 107.21.251.218 51235 184.73.226.101 51235 23.23.201.55 51235 + +# These validators are taken from the v0.16 release notes on the wiki: +# https://ripple.com/wiki/Latest_rippled_release_notes +[validators] +n9KPnVLn7ewVzHvn218DcEYsnWLzKerTDwhpofhk4Ym1RUq4TeGw RIP1 +n9LFzWuhKNvXStHAuemfRKFVECLApowncMAM5chSCL9R5ECHGN4V RIP2 +n94rSdgTyBNGvYg8pZXGuNt59Y5bGAZGxbxyvjDaqD9ceRAgD85P RIP3 +n9LeQeDcLDMZKjx1TZtrXoLBLo5q1bR1sUQrWG7tEADFU6R27UBp RIP4 +n9KF6RpvktjNs2MDBkmxpJbup4BKrKeMKDXPhaXkq7cKTwLmWkFr RIP5 + +# Ditto. +[validation_quorum] +3 + diff --git a/doc/rippled.init b/doc/rippled.init new file mode 100644 index 000000000..79604a3fc --- /dev/null +++ b/doc/rippled.init @@ -0,0 +1,101 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: ripple +# Required-Start: $local_fs $remote_fs $network $syslog +# Required-Stop: $local_fs $remote_fs $network $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: starts the ripple network node +# Description: starts rippled using start-stop-daemon +### END INIT INFO + +set -e + +NAME=rippled +USER="rippled" +GROUP="rippled" +PIDFILE=/var/run/$NAME.pid +DAEMON=/usr/local/sbin/rippled +DAEMON_OPTS="--conf /etc/ripple/rippled.cfg" +NET_OPTS="--net $DAEMON_OPTS" + +export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" + +case "$1" in + start) + echo -n "Starting daemon: "$NAME + start-stop-daemon --start --quiet --background -m --pidfile $PIDFILE \ + --exec $DAEMON --chuid $USER --group $GROUP --verbose -- $NET_OPTS + echo "." + ;; + + stop) + echo -n "Stopping daemon: "$NAME + $DAEMON $DAEMON_OPTS stop + rm -f $PIDFILE + echo "." + ;; + + restart) + echo -n "Restarting daemon: "$NAME + $DAEMON $DAEMON_OPTS stop + rm -f $PIDFILE + start-stop-daemon --start --quiet --background -m --pidfile $PIDFILE \ + --exec $DAEMON --chuid $USER --group $GROUP -- $NET_OPTS + echo "." + ;; + + status) + echo "Status of $NAME:" + echo -n "PID of $NAME: " + if [ -f "$PIDFILE" ]; then + cat $PIDFILE + $DAEMON $DAEMON_OPTS server_info + else + echo "$NAME not running." + fi + echo "." + ;; + + fetch) + echo "$NAME ledger fetching info:" + $DAEMON $DAEMON_OPTS fetch_info + echo "." + ;; + + uptime) + echo "$NAME uptime:" + $DAEMON $DAEMON_OPTS get_counts + echo "." + ;; + + startconfig) + echo "$NAME is being started with the following command line:" + echo "$DAEMON $NET_OPTS" + echo "." + ;; + + command) + # Truncate the script's argument vector by one position to get rid of + # this entry. + shift + + # Pass the remainder of the argument vector to rippled. + $DAEMON $DAEMON_OPTS "$@" + echo "." + ;; + + test) + $DAEMON $DAEMON_OPTS ping + echo "." + ;; + + *) + echo "Usage: $0 {start|stop|restart|status|fetch|uptime|startconfig|" + echo " command|test}" + exit 1 +esac + +exit 0 +