The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-18-2008
mansa mansa is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 33
is that possible to keep statements in any loop??

Hi,

Actually i stored all validdisks in one array and corresponding partitions required for all individual disks in other array..

Example:
Validdisks[$diskcnt]=dsk2 dsk3 dsk5
ValidPartition[$Partitioncnt]=4 4 3

Now i have to create domain..

Domain creation can be done by below commands:
fs_setup -d /dev/disk/${Validdisks[0]}a -n ${cfsfailover_dmn} -m ${cfsfailover_mnt}"
addvol /dev/disk/${Validdisks[$diskcnt]}h ${cfsfailover_dmn}
addvol /dev/disk/${Validdisks[$diskcnt]}g ${cfsfailover_dmn}
addvol /dev/disk/${Validdisks[$diskcnt]}b ${cfsfailover_dmn}
addvol /dev/disk/${Validdisks[$diskcnt]}a ${cfsfailover_dmn}

But tricky is there in creating domain...
Lets go first with Validdisk[0] element:
============================
By checking the elements in ValidPartition[$Partitioncnt] array,i need to create.. Since first element of ValidPartition[0]=4 means (we have to use a,b,g,h)

Domain creation for one disk wil be as below:
fs_setup -d /dev/disk/${Validdisks[0]}a -n ${cfsfailover_dmn} -m ${cfsfailover_mnt}"
addvol /dev/disk/${Validdisks[$diskcnt]}b ${cfsfailover_dmn}
addvol /dev/disk/${Validdisks[$diskcnt]}g ${cfsfailover_dmn}
addvol /dev/disk/${Validdisks[$diskcnt]}h ${cfsfailover_dmn}

And lets go with second element of validdisk[1]
Now here By checking the elements in ValidPartition[1] here it has 4 so again domain creation for second disk must be as below:

addvol /dev/disk/${Validdisks[$diskcnt]}a ${cfsfailover_dmn}
addvol /dev/disk/${Validdisks[$diskcnt]}b ${cfsfailover_dmn}
addvol /dev/disk/${Validdisks[$diskcnt]}g ${cfsfailover_dmn}
addvol /dev/disk/${Validdisks[$diskcnt]}h ${cfsfailover_dmn}

And lets go with third element of Validdisk[2]
Now here By checking the elements in ValidPartition[2] here it has 3 so use a,b,g only

addvol /dev/disk/${Validdisks[$diskcnt]}a ${cfsfailover_dmn}
addvol /dev/disk/${Validdisks[$diskcnt]}b ${cfsfailover_dmn}
addvol /dev/disk/${Validdisks[$diskcnt]}g ${cfsfailover_dmn}

And note that, "
fs_setup -d /dev/disk/${Validdisks[0]}a -n ${cfsfailover_dmn} -m ${cfsfailover_mnt}"
that should be written only once for first disk.. Later on we have to use addvol statements...Could you please help me by doing this in KSH scripting..Is that possible to keep in for loop?? Please provide your inputs..Thanks,Mansa