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_at_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.
*****************************************************************************
Received on Mon Dec 24 2001 - 10:55:00 NZDT