Operating System - HP-UX
1830367 Members
1966 Online
110001 Solutions
New Discussion

Some simple script logic - I'm loosing my touch!!

 
Tony Walker
Frequent Advisor

Some simple script logic - I'm loosing my touch!!

Hi Guys,

Nice easy one here but I'm at a loss for the best way to do it.

I just want to make sure each volume in the rootdg group is mirrored. So, I figure, vxprint and grep out the volume name. I then want to enure that there is a v entry and 2 'pl' entires for each volume. I was thinking of using awk to parse each line and search for the volume name and then check the beginning of the lines but it just seems too long winded. Shorter ideas would be appreciated..

Thanks,

Tony
6 REPLIES 6
Fred Ruffet
Honored Contributor

Re: Some simple script logic - I'm loosing my touch!!

wouldn't this be enough ?

#for i in `vgdisplay -v vg00 | grep "LV Name" | sed "s/^ *LV Name *//"`
> do
> echo "$i : \c"
> lvdisplay $i | grep -i mirror | tr -s " " " "
> done
/dev/vg00/lvol1 : Mirror copies 1
/dev/vg00/lvol2 : Mirror copies 1
/dev/vg00/lvol10 : Mirror copies 1
/dev/vg00/lvol3 : Mirror copies 1
/dev/vg00/lvol4 : Mirror copies 1
/dev/vg00/lvol5 : Mirror copies 1
/dev/vg00/lvol6 : Mirror copies 1
/dev/vg00/lvol7 : Mirror copies 1
/dev/vg00/lvol8 : Mirror copies 1
/dev/vg00/lvol9 : Mirror copies 1
/dev/vg00/lvol11 : Mirror copies 1
/dev/vg00/lvol12 : Mirror copies 1

regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Tony Walker
Frequent Advisor

Re: Some simple script logic - I'm loosing my touch!!

Thanks Fred but I am gaining this information from Veritas Volume Manager - hence the vxprint.

Cheers
Fred Ruffet
Honored Contributor

Re: Some simple script logic - I'm loosing my touch!!

Oups :)
--

"Reality is just a point of view." (P. K. D.)
Tom Maloy
Respected Contributor

Re: Some simple script logic - I'm loosing my touch!!

How about this?

vxprint -g rootdg > data
for i in `grep "^v " data | awk '{print $2}'`
do
num_plexes=`grep "^pl $i" data | wc -l`
echo $i $num_plexes
done
Carpe diem!
Geoff Wild
Honored Contributor

Re: Some simple script logic - I'm loosing my touch!!

Here's a script I have called chkdsks:

# chkdisks
Logical Volume Filesystem Mirrored?
-------------- ---------- ---------
/dev/vg00/lvol1 /stand yes
/dev/vg00/lvol2 yes
/dev/vg00/lvol3 / yes
/dev/vg00/lvol4 /tmp yes
/dev/vg00/lvol5 /home yes
/dev/vg00/lvol6 /opt yes
/dev/vg00/lvol7 /usr yes
/dev/vg00/lvol8 /var yes
/dev/vg00/lvol9 /app yes
/dev/vg00/lvol10 /ops yes
/dev/vg00/lvol11 /data yes
/dev/vg00/lvol12 /opt/cctool yes
/dev/vg00/lvol13 /var/opt/perf/datafiles yes
/dev/vg00/lvol14 /usr/openv yes
/dev/vg00/lvpub no
/dev/vg01/lvol2 /var/adm/crash yes
/dev/vg01/swap yes


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Klaas D. Eenkhoorn
Regular Advisor

Re: Some simple script logic - I'm loosing my touch!!

Tony,

Is'nt it an option to make a 'ls' of the /dev/vg00 directory and use this as an input in a 'for . . . do' loop ?

Kl@@s