Allow STDOUT and STDERR to be set

pull/2076/head
Philip O'Toole 2015-03-25 15:54:25 -07:00
parent 2fe974f1d6
commit 2305b365fe
1 changed files with 13 additions and 2 deletions

View File

@ -27,9 +27,20 @@ if [ -r $DEFAULT ]; then
source $DEFAULT source $DEFAULT
fi fi
if [ "x$STDOUT" == "x" ]; then if [ -z "$STDOUT" ]; then
STDOUT=/dev/null STDOUT=/dev/null
fi 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 OPEN_FILE_LIMIT=65536
@ -106,7 +117,7 @@ case $1 in
log_success_msg "Starting the process" "$name" log_success_msg "Starting the process" "$name"
if which start-stop-daemon > /dev/null 2>&1; then 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 else
nohup $daemon run -config $config -pidfile $pidfile > $STDOUT 2>&1 & nohup $daemon run -config $config -pidfile $pidfile > $STDOUT 2>&1 &
fi fi