Wednesday, November 09, 2016

File system random write test

wtest()
{
    val=$(( ($RANDOM % 10000 ) + 1 ))
    name=$val
    echo $name
    while [ $val != 0 ]
    do
        echo $val >> $name
        val=$(( $val - 1 ))
    done
    rm $name
}

md5sum files in directories and check

job()
{
    while true
    do
        find bin/ etc/ lib/ sbin/ selinux/ system/ usr/ -type f -exec md5sum \{\} \; > $name
        cal=`md5sum $name | awk -e "{print \\$1}"`
        if [ $cal != 207c55670e306a3a06ea87456e0859da ]
        then
            echo Mismatch
            break
        fi
        sleep $(( ($RANDOM % 20 )  + 1 ))
    done
}

Flush cache

nocache()
{
    while true
    do
        sync
        echo 3 > /proc/sys/vm/drop_caches
        sleep $(( ($RANDOM % 20 )  + 1 ))
    done
}