From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <102653644221804.tru64-unix-managers.marc@archive.invalid> From: "Smith, Lawrie" Date: Mon, 24 Dec 2001 10:53:59 +0000 To: tru64-unix-managers Subject: Vdump and TZ877 Changer X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=102653644221804 MIME-Version: 1 Content-Type: multipart/mixed; boundary="------_=_NextPart_001_01C18C69.4A68EE50" 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 Vdump and TZ877 Changer

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 = +=3D 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 (( $? !=3D 0 = ))
    then
        (( = ERR_COUNT +=3D 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

------_=_NextPart_001_01C18C69.4A68EE50--