s4
changeset 531:01b9e2b16d7a
Redirect stderr to file only if being called via CGI
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Sat, 06 Apr 2019 18:26:33 +0900 |
parents | b9d80980b7b4 |
children | c4597d0873e6 |
files | s4-funcs.sh |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line diff
1.1 --- a/s4-funcs.sh Sat Apr 06 18:20:21 2019 +0900 1.2 +++ b/s4-funcs.sh Sat Apr 06 18:26:33 2019 +0900 1.3 @@ -7,6 +7,7 @@ 1.4 myname=`basename ${SCRIPT_NAME:-$0}` 1.5 mydir=`dirname ${SCRIPT_FILENAME:-$0}` 1.6 myargs="$@" 1.7 +test -n "$HTTP_HOST" && isCGI=true 1.8 PATH=/usr/local/sqlite3/bin:/usr/local/vim7/bin:/usr/iekei/ImageMagick/bin:/usr/local/ImageMagick/bin:$PATH 1.9 tmpdir=${TMPDIR:-tmp} 1.10 dbdir=${DBDIR:-db} 1.11 @@ -346,9 +347,11 @@ 1.12 #tail -f $sqi | sq $db & # "tail -f" is too heavy. DO NOT USE!! 1.13 sq $db < $sqi & 1.14 sq3pid="`jobs -p` $!" 1.15 - exec 2>> $tmpdir/error.out 1.16 + if [ -z "$isCGI" ]; 1.17 + exec 2>> $tmpdir/error.out 1.18 + fi 1.19 exec 3>> $tmpdir/debug.out 1.20 - exec 5> $sqi # Turning $sqi access through fd5 for continuous open state 1.21 + exec 5> $sqi # Turning $sqi access through fd5 for continuous open state 1.22 rm $sqi 1.23 } 1.24 cleanup2() { # Dirty workaround for produced zombie processes