From 2305b365fee93deb63dd6b40f11bb099ebfda48d Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Wed, 25 Mar 2015 15:54:25 -0700 Subject: [PATCH] Allow STDOUT and STDERR to be set --- scripts/init.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/init.sh b/scripts/init.sh index deffe6607f..c75b04a180 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -27,9 +27,20 @@ if [ -r $DEFAULT ]; then source $DEFAULT fi -if [ "x$STDOUT" == "x" ]; then +if [ -z "$STDOUT" ]; then STDOUT=/dev/null fi +if [ ! -f "$STDOUT" ]; then + mkdir -p `dirname $STDOUT` +fi + +if [ -z "$STDERR" ]; then + STDERR=/var/log/influxdb/influxd.log +fi +if [ ! -f "$STDERR" ]; then + mkdir -p `dirname $STDERR` +fi + OPEN_FILE_LIMIT=65536 @@ -106,7 +117,7 @@ case $1 in log_success_msg "Starting the process" "$name" if which start-stop-daemon > /dev/null 2>&1; then - start-stop-daemon --chuid influxdb:influxdb --start --quiet --pidfile $pidfile --exec $daemon -- -pidfile $pidfile -config $config > $STDOUT 2>&1 & + start-stop-daemon --chuid influxdb:influxdb --start --quiet --pidfile $pidfile --exec $daemon -- -pidfile $pidfile -config $config >$STDOUT 2>$STDERR & else nohup $daemon run -config $config -pidfile $pidfile > $STDOUT 2>&1 & fi