Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 46bb3d00cd
Fetching contributors…

Cannot retrieve contributors at this time

executable file 46 lines (45 sloc) 1.144 kb
#!/bin/bash
if [ -z "$1" ]; then
echo 'Must specify operation to run. Aborting.'
exit 1
fi
case "$1" in
iowait)
if [ ! -z "$2" ]; then
DDNUM="$2"
else
DDNUM=20
fi
ROOTBLOCKDEV=`df -P / | tail -n1 | cut -f1 -d" "`
echo "Starting $DDNUM processes:"
for i in `seq 1 $DDNUM`; do
THISPID=`dd if=$ROOTBLOCKDEV of=/dev/null seek=$((RANDOM * 100)) & echo $!`
DDPID=$DDPID:$THISPID
echo " $i of $DDNUM... [$THISPID]"
done
echo "done."
echo
echo "$DDNUM processes started. You can either let them run until they finish"
echo "or you may terminate them all now by typing 'DIE'"
read -p "Terminate the processes? "
if [ "$REPLY" == "DIE" ]; then
echo -n "Terminating $DDNUM processes... "
echo $DDPID | cut -f2- -d: | tr : ' ' | xargs kill
sleep 3
echo "done."
if pidof /bin/dd > /dev/null; then
echo 'These processes remain: ' `pidof /bin/dd`
fi
fi
exit 0
;;
panic)
# This *will* cause a kernel panic if run as root. Consider yourself warned. Halfheartedly.
echo 1 > /proc/sys/kernel/panic_on_oops
cat /dev/zero > /dev/kmem
;;
*)
echo "Sorry, I don't know how to do '$1', aborting"
exit 1
;;
esac
Jump to Line
Something went wrong with that request. Please try again.