Tuesday, May 5, 2015

Fwd: Another shell script by name fillDisk

#!/bin/sh
# Script to generate 100GB folders
# 20150420 (1GB)
#    -- 20 files of 50MB each

PATHTOBB="."
DATECOUNT=20
MONTHCOUNT=04

# Infinite loop.... Will fill the HDD...
while :
do
# Check if DATECOUNT is in single digits;
if [ $DATECOUNT -lt 10 ]
then
DATECOUNT="0$DATECOUNT"
fi
#echo "18 DATECOUNT::::: $DATECOUNT"

#echo "20 MKDIR: $
PATHTOBB/2015$MONTHCOUNT$DATECOUNT"
mkdir -p $
PATHTOBB/2015$MONTHCOUNT$DATECOUNT
COUNT=1

# Logic for writing 1GB folder
while [ $COUNT -lt 21 ]
do

#echo "28 File to write: 2015$MONTHCOUNT$DATECOUNT/$COUNT.img"
cp ./file.img $
PATHTOBB/2015$MONTHCOUNT$DATECOUNT/$COUNT.img
COUNT=`expr $COUNT + 1`
done # DONE 1 GB Folder   
echo "WROTE 1GB Data..."

DATECOUNT=`expr $DATECOUNT - 1`
#echo "35 DATECOUNT: $DATECOUNT"
if [ $DATECOUNT -lt 1 ]
then
DATECOUNT=30
#echo "39 Reset DATECOUNT: $DATECOUNT"
MONTHCOUNT=`expr $MONTHCOUNT - 1`

if [ $MONTHCOUNT -lt 10 ]
then
MONTHCOUNT="0$MONTHCOUNT"
fi
#echo "46 MONTHCOUNT: $MONTHCOUNT"

fi

sleep 1
done


# dd if=/dev/zero of=output.file bs=1M count=50

No comments:

Post a Comment