write to pwd rather than tmp directory

This commit is contained in:
Mason Rowe 2019-10-08 00:01:51 -04:00
parent 9a832d7e1d
commit a4a452d969
2 changed files with 7 additions and 8 deletions

View File

@ -31,7 +31,7 @@ Options can be grouped together to skip multiple tests, i.e. `./yabs -dg` to ski
* **dd** - the dd utility is utilized to test disk performance. Both write and read speeds are evaluated by writing to and reading from a test file. __\*Disclaimer__: read speeds may be heavily influenced by cache depending on configuration of the host.
* **iperf3** - the industry standard for testing download and upload speeds to various locations. This script utilizes iperf3 with 8 parallel threads and tests both download and upload speeds. If an iperf server is busy after 10 tries, the speed test for that location/direction is skipped.
* **Geekbench 4** - Geekbench is a benchmarking program that meastures system performance, which is widely used in the tech community. The web URL is displayed to be able to see complete test and individual benchmark results and allow comparison to other geekbench'd systems. The claim URL to add the Geekbench 4 result to your Geekbench profile is written to a file in the directory that this script is executed from.
* **Geekbench 4** - Geekbench is a benchmarking program that measures system performance, which is widely used in the tech community. The web URL is displayed to be able to see complete test and individual benchmark results and allow comparison to other geekbench'd systems. The claim URL to add the Geekbench 4 result to your Geekbench profile is written to a file in the directory that this script is executed from.
## Example Output

13
yabs.sh
View File

@ -31,7 +31,7 @@ TOTAL_DISK=$(df -t simfs -t ext2 -t ext3 -t ext4 -t btrfs -t xfs -t vfat -t ntfs
echo -e "Disk : $TOTAL_DISK"
DATE=`date -Iseconds | sed -e "s/:/_/g"`
YABS_PATH=/tmp/$DATE/
YABS_PATH=./$DATE/
mkdir -p $YABS_PATH
SKIP_DD=""
@ -56,14 +56,14 @@ function dd_test {
OS=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
while [ $I -lt 3 ]
do
DD_WRITE_TEST=$(dd if=/dev/zero of=$DATE.test bs=64k count=16k oflag=direct |& grep copied)
DD_WRITE_TEST=$(dd if=/dev/zero of=$YABS_PATH/$DATE.test bs=64k count=16k oflag=direct |& grep copied)
[[ "$OS" == *"CentOS"* ]] && DD_WRITE_TEST=$(echo $DD_WRITE_TEST | awk '{ print $8 " " $9 }') || DD_WRITE_TEST=$(echo $DD_WRITE_TEST | awk '{ print $10 " " $11 }')
DD_WRITE_TEST_RES+=( "$DD_WRITE_TEST" )
VAL=$(echo $DD_WRITE_TEST | cut -d " " -f 1)
[[ "$DD_WRITE_TEST" == *"GB"* ]] && VAL=$(awk -v a="$VAL" 'BEGIN { print a * 1000 }')
DD_WRITE_TEST_AVG=$(awk -v a="$DD_WRITE_TEST_AVG" -v b="$VAL" 'BEGIN { print a + b }')
DD_READ_TEST=$(dd if=$DATE.test of=/dev/null bs=64k |& grep copied)
DD_READ_TEST=$(dd if=$YABS_PATH/$DATE.test of=/dev/null bs=64k |& grep copied)
[[ "$OS" == *"CentOS"* ]] && DD_READ_TEST=$(echo $DD_READ_TEST | awk '{ print $8 " " $9 }') || DD_READ_TEST=$(echo $DD_READ_TEST | awk '{ print $10 " " $11 }')
DD_READ_TEST_RES+=( "$DD_READ_TEST" )
VAL=$(echo $DD_READ_TEST | cut -d " " -f 1)
@ -79,10 +79,9 @@ function dd_test {
if [ -z "$SKIP_DD" ]; then
echo -e "Performing dd disk performance test. This may take a couple minutes to complete..."
touch $DATE.test 2> /dev/null
if [ -f "$DATE.test" ]; then
touch $YABS_PATH/$DATE.test 2> /dev/null
if [ -f "$YABS_PATH/$DATE.test" ]; then
dd_test
rm $DATE.test
if [ $(echo $DD_WRITE_TEST_AVG | cut -d "." -f 1) -ge 1000 ]; then
DD_WRITE_TEST_AVG=$(awk -v a="$DD_WRITE_TEST_AVG" 'BEGIN { print a / 1000 }')
@ -231,4 +230,4 @@ if [ -z "$SKIP_GEEKBENCH" ]; then
fi
echo -e
rm -rf /tmp/$DATE
rm -rf $YABS_PATH