#!/bin/sh # # save-vxconfigs # # Author: Todd Stansell # $Id: save-vxconfigs,v 1.11 2002-01-24 00:51:35-08 todd Exp $ # # Notes: # 1) This must be run as root. # 2) This saves all vital Veritas Volume Manager configuration # information in a single location which can be used to rebuild # disk groups and such. It should be run out of cron probably # every day. Every time anything in the vxvm configuration # changes, this should be run. Change the frequency as it is # appropriate for each host. # 3) If you don't know what to do with this information, then you # shouldn't be using it. # # A "standard" cron entry would be: # 15 5 * * * save-vxconfigs >/dev/null # BASE=`basename $0` PATH=$PATH:/usr/sbin DAY=`/bin/date +%A` LOC=/var/adm/vxvm/$DAY # make sure we're run as root if /bin/id -a | grep -v '^uid=0(' >/dev/null ; then echo "$BASE: you must be root to run this." exit 67 fi if [ ! -x /usr/sbin/vxprint ] ; then echo "$BASE: VxVM does not appear to be installed" >&2 exit 1 fi # cleanup old data or create the right directory if [ ! -d $LOC ] ; then mkdir -p $LOC else rm -rf $LOC/* fi # gather the data [ -x /usr/sbin/vxtask ] && OPT='-o alldgs' # check for VxVM 3.x vxdisk $OPT list >$LOC/vxdisk.list for DG in `vxdg -q list | awk '{ print $1 }'` ; do vxprint -g $DG -m >$LOC/$DG.vxprint done exit 0