Re: Mksysb Script
- From: Bill Verzal <bjverzal@xxxxxxxxx>
- Date: Thu, 14 Sep 2006 06:05:14 -0700
And here's mine ;) You might be deluged with responses on this one...
--- David Zarnoch <davezarn@xxxxxxxxxxx> wrote:
I have this script:
#!/bin/sh
#
#
# Purpose - mksysb script
# Author - Dave Zarnoch
# Date - 05/12/2005
# Modified -
# Modified -
# SRC - provtsm:/home/root/mksysb.sh
#
# Variables
#
DATE=$(date "+%a %b %e")
DRIVE=/dev/rmt0
log=/var/adm/mksysb.log
$loghostname=`hostname`
MAILERS='davezarn@xxxxxxxxxxx'
#
#Main
#
echo `date`: Starting mksysb on $hostname >>$log
echo >>$log
mksysb -i -e $DRIVE -V >>$log 2>>$log
RC1=$?
if [ $RC1 -eq 0 ]; then
echo "\t"mksysb RC is $RC1 >>$log
else
echo "\t"mksysb RC is $RC1 >>$log
echo "\t"Error running mksysb of rootvg. Aborting! >>$log
mail -s "mksysb backup errors running $hostname mksysb.sh script"
$MAILERS <$log
echo `date`: EXITING script >>$log
tctl -f $DRIVE offline
exit 15
fi
tctl -f $DRIVE offline
echo `date`: Finished mksysb on $hostname >>$log
mail -s "mksysb completed successfully on $hostname" $MAILERS <$log
I then put it into cron:
0 5 * * 1-5 /usr/bin/mksysb.sh >/dev/null 2>&1
Hope this helps.
Dave Zarnoch
davezarn@xxxxxxxxxxx
From: "Vincent D'Antonio" <dantoniov@xxxxxxxxx>
Reply-To: IBM AIX Discussion List <aix-l@xxxxxxxxxxxxx>
To: aix-l@xxxxxxxxxxxxx
Subject: Mksysb Script
Date: Wed, 13 Sep 2006 16:18:08 -0400
MIME-Version: 1.0
Received: from Princeton.EDU ([128.112.130.38]) by
bay0-mc1-f19.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2444); Wed,
13 Sep 2006 13:24:12 -0700
Received: from smtpserver1.Princeton.EDU (smtpserver1.Princeton.EDU
[128.112.129.65])by Princeton.EDU (8.13.8/8.13.8) with ESMTP id
k8DKKGbX011978;Wed, 13 Sep 2006 16:20:16 -0400 (EDT)
Received: from lists.Princeton.EDU (listsv440.Princeton.EDU
[128.112.131.10])by smtpserver1.Princeton.EDU (8.12.9/8.12.9) with ESMTP id
k8DKAEcq007158;Wed, 13 Sep 2006 16:18:39 -0400 (EDT)
Received: by LISTS.PRINCETON.EDU (LISTSERV-TCP/IP release 14.5) with spool
id 13405285 for aix-l@xxxxxxxxxxxxxxxxxxx; Wed, 13 Sep 2006
16:18:39 -0400
Received: from Princeton.EDU (postoffice01.Princeton.EDU [128.112.129.75])
by lists.Princeton.EDU (8.13.1/8.13.1) with ESMTP id
k8DKIdQC019859 for <aix-l@xxxxxxxxxxxxxxxxxxx>; Wed, 13 Sep 2006
16:18:39 -0400 (EDT)
Received: from Princeton.EDU (postoffice01.Princeton.EDU [128.112.129.75])
by Princeton.EDU (8.13.8/8.13.8) with ESMTP id k8DKIdvI014457 for
<aix-l@xxxxxxxxxxxxxxxxxxx>; Wed, 13 Sep 2006 16:18:39 -0400 (EDT)
Received: from emfw2.Princeton.EDU (emfw2.Princeton.EDU [128.112.128.96])
by Princeton.EDU (8.13.8/8.13.8) with ESMTP id k8DKIZCT014416 for
<aix-l@xxxxxxxxxxxxx>; Wed, 13 Sep 2006 16:18:36 -0400 (EDT)
Received: from wx-out-0506.google.com (wx-out-0506.google.com
[66.249.82.239]) by emfw2.Princeton.EDU (Spam Firewall) with ESMTP
id 3B1D435B1A for <aix-l@xxxxxxxxxxxxx>; Wed, 13 Sep 2006 16:18:09
-0400 (EDT)
Received: by wx-out-0506.google.com with SMTP id s13so2494190wxc for
<aix-l@xxxxxxxxxxxxx>; Wed, 13 Sep 2006 13:18:09 -0700 (PDT)
Received: by 10.90.50.6 with SMTP id x6mr3008088agx; Wed, 13 Sep 2006
13:18:09 -0700 (PDT)
Received: by 10.90.49.8 with HTTP; Wed, 13 Sep 2006 13:18:08 -0700 (PDT)
X-Message-Info: LsUYwwHHNt0q63jKwNMGV16WoQWiUxccY6AWeUeJPTY=
X-ASG-Debug-ID: 1158178661-29b000020001-7mZcl0
X-Barracuda-URL: http://128.112.128.96:8000/cgi-bin/mark.cgi
X-Barracuda-Connect: wx-out-0506.google.com[66.249.82.239]
X-Barracuda-Start-Time: 1158178661
X-ASG-Orig-Subj: Mksysb Script
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at Princeton.EDU
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using
global scores of TAG_LEVEL=1000.0
QUARANTINE_LEVEL=1000.0 KILL_LEVEL=1000.0
X-Proofpoint-Spam-Details: rule=quarantine_notspam policy=quarantine
score=0 mlx=0 adultscore=0 adjust=0 reason=mlx
engine=3.0.0-0608080000 definitions=main-0609130008
X-Spam-KB: http://www.Princeton.EDU/spam
X-Spam-Level: Newsgroups: bit.listserv.aix-l
X-To: AIX-L List <aix-l@xxxxxxxxxxxxx>
Precedence: list
List-Help: <https://lists.princeton.edu/cgi-bin/wa?LIST=aix-l>,
<mailto:LISTSERV@xxxxxxxxxxxxxxxxxxx?body=INFO aix-l>
List-Unsubscribe: <mailto:aix-l-unsubscribe-request@xxxxxxxxxxxxxxxxxxx>
List-Subscribe: <mailto:aix-l-subscribe-request@xxxxxxxxxxxxxxxxxxx>
List-Owner: <mailto:aix-l-request@xxxxxxxxxxxxxxxxxxx>
List-Archive: <https://lists.princeton.edu/cgi-bin/wa?LIST=aix-l>
Return-Path: owner-aix-l@xxxxxxxxxxxxx
X-OriginalArrivalTime: 13 Sep 2006 20:24:13.0142 (UTC)
FILETIME=[93BB7F60:01C6D772]
Hi Aix'ers
Did anyone write a script for mksysb and does some logging of date/time
maybe a list of files that can share it with others? We are running
aix 5.3on P520's and P570's.
Thanks in advance,
Vince
_________________________________________________________________
Check the weather nationwide with MSN Search: Try it now!
http://search.msn.com/results.aspx?q=weather&FORM=WLMTAG
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com #! /bin/ksh
#
# Program to run mksysb
#
validate() {
if [ "$tape_drive" = "" ] ; then
tape_drive="/dev/rmt0"
fi
if [ ! -r $tape_drive ] ; then
echo "Unknown tape drive specified - $tape_drive"
a=1
fi
}
getcfg() {
drive=`basename $tape_drive`
make=`lscfg -vl $drive|grep Manufacturer|cut -c37-50`
model=`lscfg -vl $drive|grep Model|cut -c37-50`
block=`lsattr -El rmt0 -a block_size|awk {'print $2'}`
t=`tty`
Uname=`uname -a`
}
doit() {
echo "####################################################################"|tee -a $log
echo "mksysb on $node begins `date`"|tee -a $log
echo "Program running as: $0" |tee -a $log
echo "I will be using tape drive: $tape_drive"|tee -a $log
echo "Which looks like a $make $model"|tee -a $log
echo "Block size is: $block"|tee -a $log
echo "Server ID: $Uname"|tee -a $log
echo "Log is: $log"|tee -a $log
echo "Error log is $errlog"|tee -a $log
echo "####################################################################"|tee -a $log
chdev -l $drive -a block_size=0
echo "mksysb on $node started `date`" |tee -a $log
exec 1>>$log 2>>$errlog
if [ -r $ex ] ; then
/usr/bin/mksysb -b 200 -m -X -e -i -p $tape_drive
rc=$?
else
/usr/bin/mksysb -b 200 -m -i -X -p $tape_drive
rc=$?
fi
exec 1>$t 2>$t
if [ "$rc" -eq "0" ] ; then
echo "mksysb completed successfully on $node on $dispdate" |tee -a $log
else
echo "mksysb FAILED on node $node on $dispdate" |tee -a $log
fi
}
cleanup() {
cat $errlog >> $log
if [ "$rc" -eq "0" ] ; then
# ### cat $log |mail -s "mksysb completed successfully on $node on $dispdate" root
echo "mksysb completed successfully on $node on $dispdate"
else
cat $log |mail -s "mksysb FAILED on node $node on $dispdate" root
fi
mt -f $tape_drive rewoffl
rm $errlog
echo "Returning tape drive to block size of $block"
chdev -l $drive -a block_size=$block
}
tape_drive=$1
date=`date +%Y%m%d%H%M%S`
dispdate=`date +%m/%d/%Y`
log="/var/mksysb.$date"
errlog="/var/mksysb.$date.err"
touch $log
touch $errlog
node=`hostname`
ex="/etc/exclude.rootvg"
a=0
validate
if [ "$a" -eq "1" ] ; then
echo "error NO_DEV for $node mksysb - ERROR"
rc=1
cleanup
exit 1
fi
getcfg
doit
cleanup
exit $rc
- References:
- Re: Mksysb Script
- From: David Zarnoch
- Re: Mksysb Script
- Prev by Date: Re: Mksysb Script
- Next by Date: HMC issues
- Previous by thread: Re: Mksysb Script
- Next by thread: Re: Mksysb Script
- Index(es):
Relevant Pages
- Re: Mksysb Script
... echo `date`: Starting mksysb on $hostname>>$log ... mail -s "mksysb
backup errors running $hostname mksysb.sh script" ... Dave Zarnoch ... (AIX-L) - Re: Mksysb Script
... I have this script: ... echo `date`: Starting mksysb on $hostname>>$log
... Dave Zarnoch ... (AIX-L)