# HG changeset patch # User HIROSE Yuuji # Date 1554542793 -32400 # Node ID 01b9e2b16d7aed99f54daff324a337c5cb84de01 # Parent b9d80980b7b4abf4b62aa39c974118cb822e3c17 Redirect stderr to file only if being called via CGI diff -r b9d80980b7b4 -r 01b9e2b16d7a s4-funcs.sh --- a/s4-funcs.sh Sat Apr 06 18:20:21 2019 +0900 +++ b/s4-funcs.sh Sat Apr 06 18:26:33 2019 +0900 @@ -7,6 +7,7 @@ myname=`basename ${SCRIPT_NAME:-$0}` mydir=`dirname ${SCRIPT_FILENAME:-$0}` myargs="$@" +test -n "$HTTP_HOST" && isCGI=true PATH=/usr/local/sqlite3/bin:/usr/local/vim7/bin:/usr/iekei/ImageMagick/bin:/usr/local/ImageMagick/bin:$PATH tmpdir=${TMPDIR:-tmp} dbdir=${DBDIR:-db} @@ -346,9 +347,11 @@ #tail -f $sqi | sq $db & # "tail -f" is too heavy. DO NOT USE!! sq $db < $sqi & sq3pid="`jobs -p` $!" - exec 2>> $tmpdir/error.out + if [ -z "$isCGI" ]; + exec 2>> $tmpdir/error.out + fi exec 3>> $tmpdir/debug.out - exec 5> $sqi # Turning $sqi access through fd5 for continuous open state + exec 5> $sqi # Turning $sqi access through fd5 for continuous open state rm $sqi } cleanup2() { # Dirty workaround for produced zombie processes