From: "Smith, Lawrie" <Lawrie.Smith () capita ! co ! uk>
To: tru64-unix-managers
Subject: Vdump and TZ877 Changer
Date: Mon, 24 Dec 2001 10:53:59 +0000 [thread overview]
Message-ID: <102653644221804.tru64-unix-managers.marc@archive.invalid> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: multipart/mixed; boundary="------_=_NextPart_001_01C18C69.4A68EE50", Size: 9681 bytes --]
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C18C69.4A68EE50
Content-Type: text/plain
Seasons greetings to you all!
This subject will be old news to many. I have been trying to find a "good"
method for vdump backups to span media via a cron. The archives appear
unanimous, use expect. OK, so I have downloaded, compiled and installed
expect. I'm not sure about the best way to implement this. I have a backup
script which iterates through all the advfs files systems as below.
# Report the tape status
mt -f $NR_DEVICE status >> $LOG_FILE
/sbin/mount -t advfs | while read DOMAIN JUNK FS JUNK2
do
(( VOL_COUNT += 1 ))
echo "Begin vdump of Domain : "$DOMAIN >> $LOG_FILE
echo "Begin vdump of Fileset : "$FS >> $LOG_FILE
echo "Begin vdump of Tape Volume : "$VOL_COUNT >> $LOG_FILE
/sbin/vdump -0 -CUu -f $NR_DEVICE $FS >> $LOG_FILE 2>&1
if (( $? != 0 ))
then
(( ERR_COUNT += 1 ))
echo "************************************************************"
>> $LOG_FILE
echo "ERRORS in vdump of Tape Volume : "$VOL_COUNT >> $LOG_FILE
echo "************************************************************"
>> $LOG_FILE
echo `date` >> $LOG_FILE
echo `date`" ERROR in backup volume : "$VOL_COUNT $FS $DOMAIN >
$CONSOLE
echo `date`" ERROR backup volume : "$VOL_COUNT $FS $DOMAIN | mail
root
else
echo "Finish vdump of Tape Volume : "$VOL_COUNT >> $LOG_FILE
echo `date` >> $LOG_FILE
echo `date`" SUCCESS backup volume : "$VOL_COUNT $FS $DOMAIN >
$CONSOLE
echo `date`" OK backup volume : "$VOL_COUNT $FS $DOMAIN | mail root
fi
done
The question is how to use expect with this. Can I create a function which
will call expect for each file system or do I spawn the whole script as per
...
#!/usr/local/bin/expect
set timeout -1
spawn backup-script.sh
set processo $spawn_id
send_user "\n started process $processo\n"
expect {
"vdump: Press RETURN when tape is mounted..."\
{sleep 120; send "\r"; exp_continue}
eof {send_user "\n EOF found! \n"}
}
send_user "\n process $processo ENDED \n"
I'm sure many will have tackled this question, any advice, sample scripts
welcomed.
Kind regards
Lawrie Smith
Capita Technical Services
West Malling
email: lawrie.smith@capita.co.uk
Tel: 01732 877266
www.capita.co.uk
Capita Group LTD Tel: +44 (0)8705-234567
********************** N O T I C E ********************************************
The information in this message is confidential. It is intended solely for the addressee. Access to this message by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful.
We do not accept legal responsibility for the contents of this message and whilst any attachments to this message may have been checked for viruses, you should rely on your own virus checker and procedures.
If you contact us by e-mail, we will store your name and address to facilitate communications.
Any statements contained in this message are those of the individual and not the organisation.
*****************************************************************************
------_=_NextPart_001_01C18C69.4A68EE50
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>Vdump and TZ877 Changer</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2 FACE=3D"Arial">Seasons greetings to you all!</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">This subject will be old news to many. =
I have been trying to find a "good" method for vdump backups =
to span media via a cron. The archives appear unanimous, use expect. =
OK, so I have downloaded, compiled and installed expect. I'm not sure =
about the best way to implement this. I have a backup script which =
iterates through all the advfs files systems as below.</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Fixedsys"># Report the tape status</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> mt -f $NR_DEVICE status =
>> $LOG_FILE</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> /sbin/mount -t advfs | =
while read DOMAIN JUNK FS JUNK2</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> do</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> (( VOL_COUNT =
+=3D 1 ))</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> echo =
"Begin vdump of Domain : =
"$DOMAIN >> $LOG_FILE</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> echo =
"Begin vdump of Fileset : "$FS =
>> $LOG_FILE</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> echo =
"Begin vdump of Tape Volume : "$VOL_COUNT >> =
$LOG_FILE</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> /sbin/vdump -0 =
-CUu -f $NR_DEVICE $FS >> $LOG_FILE 2>&1</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> if (( $? !=3D 0 =
))</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> then</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Fixedsys"> (( =
ERR_COUNT +=3D 1 ))</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Fixedsys"> echo =
"************************************************************"=
>> $LOG_FILE</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Fixedsys"> echo =
"ERRORS in vdump of Tape Volume : "$VOL_COUNT >> =
$LOG_FILE</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Fixedsys"> echo =
"************************************************************"=
>> $LOG_FILE</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Fixedsys"> echo =
`date` >> $LOG_FILE</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Fixedsys"> echo =
`date`" ERROR in backup volume : "$VOL_COUNT $FS $DOMAIN > =
$CONSOLE</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Fixedsys"> echo =
`date`" ERROR backup volume : "$VOL_COUNT $FS $DOMAIN | mail =
root</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> else</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Fixedsys"> echo =
"Finish vdump of Tape Volume : "$VOL_COUNT >> =
$LOG_FILE</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Fixedsys"> echo =
`date` >> $LOG_FILE</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Fixedsys"> echo =
`date`" SUCCESS backup volume : "$VOL_COUNT $FS $DOMAIN > =
$CONSOLE</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Fixedsys"> echo =
`date`" OK backup volume : "$VOL_COUNT $FS $DOMAIN | mail =
root</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> fi</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> done</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Fixedsys">The question is how to use expect =
with this. Can I create a function which will call expect for each file =
system or do I spawn the whole script as per ...</FONT></P>
<BR>
<P><FONT SIZE=3D2 FACE=3D"Fixedsys"> =
#!/usr/local/bin/expect</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> set =
timeout -1</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> spawn =
backup-script.sh</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> set =
processo $spawn_id</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> send_user =
"\n started process $processo\n"</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> expect =
{</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Fixedsys"> =
"vdump: Press RETURN when tape is mounted..."\</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Fixedsys"> =
{sleep 120; send "\r"; =
exp_continue}</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Fixedsys"> =
eof {send_user "\n EOF found! =
\n"}</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Fixedsys"> =
}</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Fixedsys"> send_user =
"\n process $processo ENDED \n"</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Fixedsys">I'm sure many will have tackled =
this question, any advice, sample scripts welcomed.</FONT>
</P>
<BR>
<P><FONT SIZE=3D2 FACE=3D"Tahoma">Kind regards</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Tahoma">Lawrie Smith</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Tahoma">Capita Technical Services</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Tahoma">West Malling</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Tahoma">email: =
lawrie.smith@capita.co.uk</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Tahoma">Tel: 01732 =
877266</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C18C69.4A68EE50--
reply other threads:[~2001-12-24 10:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox