From 21faf8eaebd2cdb79b721457e3ca3ac393032bfc Mon Sep 17 00:00:00 2001 From: The Doctor Date: Tue, 17 Dec 2013 15:57:02 -0800 Subject: [PATCH] Improvements to initscript and default configuration. * Added absolute paths to the [node_db] and [debug_logfile] stanzas in the config file. * Changed some tabs into spaces for consistency. * Added directory tree sanity checking to initscript. Signed-off-by: The Doctor --- doc/rippled-example.cfg | 4 ++-- doc/rippled.init | 25 +++++++++++++++++++------ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/doc/rippled-example.cfg b/doc/rippled-example.cfg index c3678a9fcb..f315e1964d 100644 --- a/doc/rippled-example.cfg +++ b/doc/rippled-example.cfg @@ -785,12 +785,12 @@ medium # Note that HyperLevelDB is unavailable on Windows platforms [node_db] type=HyperLevelDB -path=db/hyperldb +path=/etc/ripple/db/hyperldb # This needs to be an absolute directory reference, not a relative one. # Modify this value as required. [debug_logfile] -log/debug.log +/var/log/rippled/debug.log [sntp_servers] time.windows.com diff --git a/doc/rippled.init b/doc/rippled.init index 79604a3fc9..7aba5d9f27 100644 --- a/doc/rippled.init +++ b/doc/rippled.init @@ -19,9 +19,22 @@ PIDFILE=/var/run/$NAME.pid DAEMON=/usr/local/sbin/rippled DAEMON_OPTS="--conf /etc/ripple/rippled.cfg" NET_OPTS="--net $DAEMON_OPTS" +LOGDIR="/var/log/rippled" +DBDIR="/var/db/rippled/db/hyperldb" export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" +# I wish it didn't come down to this, but this is the easiest way to ensure +# sanity of an install. +if [ ! -d $LOGDIR ]; then + mkdir -p $LOGDIR + chown $USER:$GROUP $LOGDIR +fi +if [ ! -d $DBDIR ]; then + mkdir -p $DBDIR + chown -R $USER:$GROUP $DBDIR +fi + case "$1" in start) echo -n "Starting daemon: "$NAME @@ -50,11 +63,11 @@ case "$1" in 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 + cat $PIDFILE + $DAEMON $DAEMON_OPTS server_info + else + echo "$NAME not running." + fi echo "." ;; @@ -93,7 +106,7 @@ case "$1" in *) echo "Usage: $0 {start|stop|restart|status|fetch|uptime|startconfig|" - echo " command|test}" + echo " command|test}" exit 1 esac