Attached is a shell script that was shared by someone on this list a long
while back.

On Sat, 2 Sep 2000, Stefan Llabres wrote:

> Talafous, John G. wrote:
> > Excellent outline/recap of steps to recover TSM on AIX. However, I have not
> > heard of the 'savevg' mentioned in the second step. Could you please provide
> > details? Where can I find documentation to lead me on this path?
>
> savevg ist part of aix and documented in the os guide (an man pages).
>
> S.Llabres
>
#!/usr/bin/ksh

# The shell will save the volume group descriptions for the
# non-rootvg volume groups using the savevg command.  This
# output can be used by the restore vg command to recreate 
# the volume groups.  For example:
#       restvg -qf /vg_images/savevg.$VGNAME

rm -f /vg_images/savevg.*
rm -f /tmp/savevg
integer total_error=0

# 1) get the non-rootvg volume groups (vg)
# 2) get the logical volumes (lv) by vg's, remove the header
#    line, remove the unmounted & raw lv's, remove the nfs
#    mounted files and print the mount point.
# 3) save the mount point in /etc/exclude.$VGNAME
# 4) save the volume group information for each volume group,
#    while excluding the actual files, in /vg_images/savevg.$VGNAME

lsvg -o |grep -v rootvg |while read VGNAME
        do
        lsvg -l $VGNAME |grep -v LV | grep -v "N/A" | grep / | awk '{print $7 "/"} ' \
                > /etc/exclude.$VGNAME 
        savevg -eif/vg_images/savevg.$VGNAME $VGNAME >> /tmp/savevg 2>&1
        (( total_error = total_error + $? ))
done

if (( total_error > 0 ))
then
        /bin/mail -s "`hostname`: savevg had errors" admin < /tmp/savevg
        exit 1
fi
exit 0

Reply via email to