#!/bin/sh
#==============================================================================
# (C) Copyright IBM Corp. 2003    All Rights Reserved.
# simfail-withio ($Revision: 1.3 $)
# US Government Users Restricted Rights -
# Use, duplication or disclosure restricted by
# GSA ADP Schedule Contract with IBM Corp.
#
# Author(s): S. Bader <shbader@de.ibm.com>
#
# This file is part of MDMPD
#
# MDMPD is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# MDMPD is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with MDMPD; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#==============================================================================
function Abort() {
	echo "Aborting"
	REPEAT=false
	if [ "$JOB" != "" ]; then
		echo "Killing $JOB"
		kill $JOB
		unset JOB
	fi
}
trap Abort 1 2 3 15

./simfail &
JOB=$!

while $REPEAT; do
	echo "DD starts"
	dd if=/dev/zero of=/dev/md0 bs=1M
	echo "DD ends (RC=$?)"
done

wait
exit 0

