#!/bin/sh
# Copyright (c) 2011, Couchbase, Inc.
# All rights reserved.

PATH="/opt/couchbase/bin":$PATH
export PATH

ERL_LIBS="/opt/couchbase/lib/couchdb/erlang/lib:/opt/couchbase/lib/ns_server/erlang/lib"
export ERL_LIBS

if [ x"$1" != "x" ]
then
    extra_args="-log $1"
fi

exec erl -pa ebin -noshell -run ns_log_browser \
         -report_dir "/opt/couchbase/var/lib/couchbase/logs" ${extra_args} \
         -run init stop -- "$@"
