Browse Source

bin/server-audit.sh: fix answer's overwrite at log parse when log size is big

pull/6/head
PostgreSQL Server 8 years ago
parent
commit
7679ee27ae
  1. 20
      bin/server-audit.sh

20
bin/server-audit.sh

@ -301,14 +301,17 @@ if [[ $answer == "y" ]]; then
else else
answer="y" # size is less than 2Gb and it's acceptable for us. answer="y" # size is less than 2Gb and it's acceptable for us.
fi fi
answer=""
if [[ $pgLcMessages != 'C' && $pgLcMessages != *"en_US"* ]]; then # print warning about the log size if [[ $answer == "y" ]]; then
while [[ $answer != "y" && $answer != "n" ]] answer=""
do if [[ $pgLcMessages != 'C' && $pgLcMessages != *"en_US"* ]]; then # print warning about the log size
read -p "${red}PostgreSQL server's lc_messages is neither C nor en_US.UTF-8. ${yellow}Parse the log anyway? [y/n]: ${reset}" answer while [[ $answer != "y" && $answer != "n" ]]
done do
else read -p "${red}PostgreSQL server's lc_messages is neither C nor en_US.UTF-8. ${yellow}Parse the log anyway? [y/n]: ${reset}" answer
answer="y" # no problem with lc_messages done
else
answer="y" # no problem with lc_messages
fi
fi fi
if [[ $answer == "y" ]]; then # we are ready to parse log if [[ $answer == "y" ]]; then # we are ready to parse log
@ -316,6 +319,7 @@ if [[ $answer == "y" ]]; then
if [[ $pvUtil == true ]]; then # handle log with pv if [[ $pvUtil == true ]]; then # handle log with pv
pv --progress --timer --eta --bytes --width 100 --rate-limit $pvLimit $pgCompleteLogPath |grep -oE '(ERROR|WARNING|FATAL|PANIC).*' > $tempPgLog pv --progress --timer --eta --bytes --width 100 --rate-limit $pvLimit $pgCompleteLogPath |grep -oE '(ERROR|WARNING|FATAL|PANIC).*' > $tempPgLog
else # do it without pv else # do it without pv
echo "answer: $answer"
grep -oE '(ERROR|WARNING|FATAL|PANIC).*' $pgCompleteLogPath > $tempPgLog grep -oE '(ERROR|WARNING|FATAL|PANIC).*' $pgCompleteLogPath > $tempPgLog
fi fi

Loading…
Cancel
Save