- rm -f $targetdir/stderr
- # stop all arrays, just incase some script left an array active.
- mdadm -Ssq
- mdadm --zero $devlist 2> /dev/null
- mdadm --zero $devlist 2> /dev/null
- # source script in a subshell, so it has access to our
- # namespace, but cannot change it.
- if ( set -ex ; . $script ) 2> $targetdir/log
- then echo "$script succeeded"
- else cat $targetdir/log ; cat $targetdir/stderr
- echo "$script failed"
- exit 1
- fi
+ rm -f $targetdir/stderr
+ # stop all arrays, just incase some script left an array active.
+ $mdadm -Ssq 2> /dev/null
+ mdadm --zero $devlist 2> /dev/null
+ mdadm --zero $devlist 2> /dev/null
+ # this might have been reset: restore the default.
+ echo 2000 > /proc/sys/dev/raid/speed_limit_max
+ # source script in a subshell, so it has access to our
+ # namespace, but cannot change it.
+ echo -ne "$_script... "
+ if ( set -ex ; . $_script ) &> $targetdir/log
+ then
+ echo "succeeded"
+ _fail=0
+ else
+ log=log
+ cat $targetdir/stderr >> $targetdir/log
+ echo "=======================dmesg=================" >> $targetdir/log
+ dmesg | tail -n 200 >> $targetdir/log
+ if [ $exitonerror == 0 ]; then
+ log=log-`basename $_script`
+ mv $targetdir/log $logdir/$log
+ fi
+ echo "FAILED - see $logdir/$log for details"
+ _fail=1
+ fi
+ if [ "$savelogs" == "1" ]; then
+ cp $targetdir/log $logdir/$_basename.log
+ fi
+ if [ "$_fail" == "1" -a "$exitonerror" == "1" ]; then
+ exit 1
+ fi