I have this script which I manually execute in one bash terminal shell, after I have executed this in another bash terminal window:
shred -n 0 -vfz /dev/sdXY
All the script does is show me iostat for the current device, and give me a time counter of how long shred is taking. I could do "time" in front of shred but that only tells me the total time taken, not a running counter and doesn't show iostat for the device I am shredding, so I have this script to do what I want.
I would like it all to be encompassed in one script so I only have to execute it with the device name.
Any ideas about incorporating it all in one script greatly appreciated.
#!/bin/bash
z=0
while true; do
a=$(ps -ef | grep -v grep | grep -q shred ; echo $?)
#echo $a
if [ $a == 0 ]; then
# echo "shred is running."
iostat -hy /dev/$1 1 1 | grep -E "Device|$1"
echo $(($z/60))":"$(($z%60))
((z+=1))
else
sleep 1
exit 1
fi
done
Thank you.
shred -n 0 -vfz /dev/sdXY
All the script does is show me iostat for the current device, and give me a time counter of how long shred is taking. I could do "time" in front of shred but that only tells me the total time taken, not a running counter and doesn't show iostat for the device I am shredding, so I have this script to do what I want.
I would like it all to be encompassed in one script so I only have to execute it with the device name.
Any ideas about incorporating it all in one script greatly appreciated.
#!/bin/bash
z=0
while true; do
a=$(ps -ef | grep -v grep | grep -q shred ; echo $?)
#echo $a
if [ $a == 0 ]; then
# echo "shred is running."
iostat -hy /dev/$1 1 1 | grep -E "Device|$1"
echo $(($z/60))":"$(($z%60))
((z+=1))
else
sleep 1
exit 1
fi
done
Thank you.

