#!/bin/sh if [ -f working/scripts/recreate_raid_arrays ];then if [ ! -f lvmdisks ];then touch lvmdisks fi cat disklist|while read LINE;do disk=`echo $LINE` grep $disk working/scripts/recreate_raid_arrays |while read line;do grep $disk checkraidtemp >>/dev/null 2>&1 if [ ! $? = 0 ];then echo $line>>checkraidtemp field=`echo $line|wc -w` while [ $field -ne 0 ];do a=`echo $line|awk "{ print \$ $field }"` echo $a|grep /dev |grep -v md|grep -v $disk>/dev/null 2>&1 if [ $? = 0 ];then grep $a disklist if [ ! $? = 0 ];then echo $a >>added_disks fi fi field=$(( field - 1 )) done field=`echo $line|wc -w` while [ $field -ne 0 ];do a=`echo $line|awk "{ print \$ $field }"` echo $a|grep md|grep -v mdadm >/dev/null 2>&1 if [ $? = 0 ];then grep $a lvmdisks if [ ! $? = 0 ];then echo $a >> raidisks fi fi field=$(( field - 1 )) done fi done done cat disklist|while read line;do if [ ! $line = "" ];then echo $line >>disklistmp fi done cat added_disks|while read line;do if [ ! $line = "" ];then echo $line>>disklistmp fi done mv disklistmp disklist echo "" > added_disks fi