Skip to content

Instantly share code, notes, and snippets.

@nmicic
Created July 21, 2022 07:08
Show Gist options
  • Select an option

  • Save nmicic/d8857ea0a9e2dfcbf5b58185f9a3b9d6 to your computer and use it in GitHub Desktop.

Select an option

Save nmicic/d8857ea0a9e2dfcbf5b58185f9a3b9d6 to your computer and use it in GitHub Desktop.
#!/bin/bash
DEBUG=1
test $DEBUG -ne 0 && set -vx
trap "date;echo Got Signal;echo 3 > /proc/sys/vm/drop_caches&rm -rf /mnt/user/hd-raid/records/cdr/Tests/*;exit;" 0 1 2 3 13 15
mkdir -p /mnt/user/hd-raid/records/cdr/Tests/
test ! -d /mnt/user/hd-raid/records/cdr/Tests/ && echo "ERROR /mnt/user/hd-raid/records/cdr/Tests/ doesn't exist" && exit
cd /mnt/user/hd-raid/records/cdr/Tests/
DAY=`date +%d`
RNDDIR="$DAY"/"$RANDOM"
mkdir -p $RNDDIR
cd $RNDDIR
for ((i=0;i<128;i++)); do
TESTpwd=`pwd | grep /mnt/user/hd-raid/records/cdr/Tests/ | wc -l`
test $TESTpwd -ne 1 && echo "ERROR not in /mnt/user/hd-raid/records/cdr/Tests" `pwd` && exit
DIRRND=/mnt/user/hd-raid/records/cdr/Tests/"$RNDDIR"
time dd if=/dev/urandom of="$DIRRND"/"$HOSTNAME"_`date +%d_%m_%Y__%H_%M_%S`_"$RANDOM"_file"$RANDOM"_r.p bs=4k count=2048
done
find /mnt/user/hd-raid/records/cdr/Tests -type f -exec md5sum {} \; > /mnt/user/hd-raid/records/cdr/Tests/MD5SUM.txt
md5sum -c /mnt/user/hd-raid/records/cdr/Tests/MD5SUM.txt
# to test on standby the same: md5sum -c /mnt/user/hd-raid/records/cdr/Tests/MD5SUM.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment