Currently Tested for Ubuntu and CentOS7.1
This commit is contained in:
Shital Savekar 2015-06-22 13:48:54 +05:30
Родитель f5f2fd6d61
Коммит 2740bf91c2
4 изменённых файлов: 1453 добавлений и 0 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,28 @@
#!/bin/bash
#V-SHISAV@MICROSOFT.COM
#HOW TO PARSE THE ARGUMENTS.. SOURCE - http://stackoverflow.com/questions/4882349/parsing-shell-script-arguments
while echo $1 | grep ^- > /dev/null; do
eval $( echo $1 | sed 's/-//g' | tr -d '\012')=$2
shift
shift
done
diskName=$diskName
delete=$delete
create=$create
forRaid=$forRaid
if [ "$create" = "yes" ]; then
if [ "$forRaid" = "yes" ]; then
(echo n; echo p; echo 1; echo; echo; echo t; echo fd; echo w) | fdisk $diskName
exitVal=$?
elif [ "$forRaid" = "no" ]; then
(echo n; echo p; echo 1; echo; echo; echo w) | fdisk $diskName
exitVal=$?
fi
fi
if [ "$delete" = "yes" ]; then
(echo d; echo w;) | fdisk $diskName
exitVal=$?
fi
exit $exitVal

Просмотреть файл

@ -0,0 +1,20 @@
#!/bin/bash
#V-SHISAV@MICROSOFT.COM
#HOW TO PARSE THE ARGUMENTS.. SOURCE - http://stackoverflow.com/questions/4882349/parsing-shell-script-arguments
while echo $1 | grep ^- > /dev/null; do
eval $( echo $1 | sed 's/-//g' | tr -d '\012')=$2
shift
shift
done
diskNames=$diskNames
create=$create
RaidName=$RaidName
totalDisks=$totalDisks
diskNames=${diskNames//^/ }
if [ "$create" = "yes" ]; then
echo y | mdadm --create $RaidName --level 0 --raid-devices $totalDisks $diskNames
exitVal=$?
fi
exit $exitVal

86
sys-custom.sh Normal file
Просмотреть файл

@ -0,0 +1,86 @@
#!/bin/sh
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# Sample script to run sysbench.
# In this script, we want to test 3 different devices, all mounted on the same
# machine. You can adapt this script to other situations easily. The only
# thing to keep in mind is that each different configuration you're testing
# must log its output to a different directory.
#
# For any info contact v-shisav@microsoft.com
while echo $1 | grep ^- > /dev/null; do
eval $( echo $1 | sed 's/-//g' | tr -d '\012')=$2
shift
shift
done
PrepareFiles=$PrepareFiles
RunTest=$RunTest
CleanUp=$CleanUp
CustomLogDir=$CustomLogDir
testIO=$testIO
testThread=$testThread
ioRuntime=$ioRuntime
testMode=$testMode
fileSize=$fileSize
set -u
set -x
#export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/share/oem/bin:/usr/share/oem/python/bin:/opt/bin
FILEIO="--test=fileio --file-total-size=${fileSize} --file-extra-flags=dsync --file-fsync-freq=0"
#FILEIO="--test=fileio --file-total-size=134G "
####################################
#All run config set here
#
LOGDIR=$CustomLogDir
mkdir -p $CustomLogDir
LOGFILE="${LOGDIR}/sysbench.log.txt"
#FILE PREPARE
echo "===================================== Starting Run $(date +"%x %r %Z") script generated 2/9/2015 4:24:44 PM ================================" >> $LOGFILE
if [ "$PrepareFiles" = "yes" ]; then
echo "" > $LOGFILE
chmod 666 $LOGFILE
echo "SYSBENCH-FILE-PREPARE-PROGRESS" > $LOGDIR/CurrentSysbenchStatus.txt
echo "Preparing Files: $FILEIO"
echo "Preparing Files: $FILEIO" >> $LOGFILE
# Remove any old files from prior runs (to be safe), then prepare a set of new files.
sysbench $FILEIO cleanup
echo "--- Disk Usage Before Generating New Files ---" >> $LOGFILE
df >> $LOGFILE
iostatfilename="${LOGDIR}/iostat-sysbench-file-prepare.txt"
nohup iostat -x 5 -t -y > $iostatfilename &
sysbench $FILEIO prepare
echo "--- Disk Usage After Generating New Files ---" >> $LOGFILE
df >> $LOGFILE
echo "=== End Preparation $(date +"%x %r %Z") ===" >> $LOGFILE
echo "SYSBENCH-FILE-PREPARE-FINISH" > $LOGDIR/CurrentSysbenchStatus.txt
iostatPID=`ps -ef | awk '/iostat/ && !/awk/ { print $2 }'`
kill -9 $iostatPID
fi
#TEST RUN
if [ "$RunTest" = "yes" ]; then
iostatfilename="${LOGDIR}/iostat-sysbench-${testMode}-${testIO}-${testThread}.txt"
nohup iostat -x 5 -t -y > $iostatfilename &
echo "------------------------------- ${testMode}, ${testIO}, ${testThread} threads ${ioRuntime} seconds------------------ $(date +"%x %r %Z") ---" >> $LOGFILE
echo "SYSBENCH-TEST-RUNNING-${testMode}-${testIO}K-${testThread}-${ioRuntime}" > $LOGDIR/CurrentSysbenchStatus.txt
sysbench $FILEIO --file-test-mode=$testMode --file-block-size=${testIO} --max-requests=0 --max-time=$ioRuntime --num-threads=$testThread run >> $LOGFILE
iostatPID=`ps -ef | awk '/iostat/ && !/awk/ { print $2 }'`
kill -9 $iostatPID
echo "SYSBENCH-TEST-FINISHED" > $LOGDIR/CurrentSysbenchStatus.txt
fi
#CLEANUP
if [ "$CleanUp" = "yes" ]; then
echo "===================================== Completed Run $(date +"%x %r %Z") script generated 2/9/2015 4:24:44 PM ================================" >> $LOGFILE
sysbench $FILEIO cleanup >> $LOGFILE
fi