Fix locale override

This commit is contained in:
Mason Rowe 2020-01-10 15:48:58 -05:00
parent dd591b9251
commit 73844833ce

10
yabs.sh
View File

@ -22,6 +22,9 @@ echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #'
echo -e echo -e
date date
# override locale to eliminate parsing errors (i.e. using commas a delimiters rather than periods)
export LC_ALL=C
# gather basic system information (inc. CPU, AES-NI/virt status, RAM + swap + disk size) # gather basic system information (inc. CPU, AES-NI/virt status, RAM + swap + disk size)
echo -e echo -e
echo -e "Basic System Information:" echo -e "Basic System Information:"
@ -89,14 +92,14 @@ function disk_test {
while [ $I -lt 3 ] while [ $I -lt 3 ]
do do
# write test using dd, "direct" flag is used to test direct I/O for data being stored to disk # write test using dd, "direct" flag is used to test direct I/O for data being stored to disk
DISK_WRITE_TEST=$(LC_ALL=C dd if=/dev/zero of=$DISK_PATH/$DATE.test bs=64k count=16k oflag=direct |& grep copied | awk '{ print $(NF-1) " " $(NF)}') DISK_WRITE_TEST=$(dd if=/dev/zero of=$DISK_PATH/$DATE.test bs=64k count=16k oflag=direct |& grep copied | awk '{ print $(NF-1) " " $(NF)}')
VAL=$(echo $DISK_WRITE_TEST | cut -d " " -f 1) VAL=$(echo $DISK_WRITE_TEST | cut -d " " -f 1)
[[ "$DISK_WRITE_TEST" == *"GB"* ]] && VAL=$(awk -v a="$VAL" 'BEGIN { print a * 1000 }') [[ "$DISK_WRITE_TEST" == *"GB"* ]] && VAL=$(awk -v a="$VAL" 'BEGIN { print a * 1000 }')
DISK_WRITE_TEST_RES+=( "$DISK_WRITE_TEST" ) DISK_WRITE_TEST_RES+=( "$DISK_WRITE_TEST" )
DISK_WRITE_TEST_AVG=$(awk -v a="$DISK_WRITE_TEST_AVG" -v b="$VAL" 'BEGIN { print a + b }') DISK_WRITE_TEST_AVG=$(awk -v a="$DISK_WRITE_TEST_AVG" -v b="$VAL" 'BEGIN { print a + b }')
# read test using dd using the 1G file written during the write test # read test using dd using the 1G file written during the write test
DISK_READ_TEST=$(LC_ALL=C dd if=$DISK_PATH/$DATE.test of=/dev/null bs=8k |& grep copied | awk '{ print $(NF-1) " " $(NF)}') DISK_READ_TEST=$(dd if=$DISK_PATH/$DATE.test of=/dev/null bs=8k |& grep copied | awk '{ print $(NF-1) " " $(NF)}')
VAL=$(echo $DISK_READ_TEST | cut -d " " -f 1) VAL=$(echo $DISK_READ_TEST | cut -d " " -f 1)
[[ "$DISK_READ_TEST" == *"GB"* ]] && VAL=$(awk -v a="$VAL" 'BEGIN { print a * 1000 }') [[ "$DISK_READ_TEST" == *"GB"* ]] && VAL=$(awk -v a="$VAL" 'BEGIN { print a * 1000 }')
DISK_READ_TEST_RES+=( "$DISK_READ_TEST" ) DISK_READ_TEST_RES+=( "$DISK_READ_TEST" )
@ -345,3 +348,6 @@ fi
# finished all tests, clean up all YABS files and exit # finished all tests, clean up all YABS files and exit
echo -e echo -e
rm -rf $YABS_PATH rm -rf $YABS_PATH
# reset locale settings
unset LC_ALL