RE: Using expect with ontape, onunload.
Posted in 2000
We use a variant of the following 'expect' script to do some of our archives
to disk via ontape (archives that exceed 2 Gb). Obviously, there is a
wrapper around this script. I'm sure it could be adapted easily to use with
onunload.
---------------------------------------------------------------
#!/usr/local/bin/expect --
#
# Setup script variables and create first archive file.
# Create symbolic link from TAPEDEV file to first archive file.
#
proc archive_setup {} {
global env FILSEQ ARCHIVELINK EXITSTS
log_file archive_exp.out
set EXITSTS 0
set FILSEQ 1
set ARCHIVELINK $env(ARCHIVEFILEDIRP)/$env(ARCHIVEBASE)$FILSEQ
exec touch $ARCHIVELINK
exec chmod 660 $ARCHIVELINK
exec chgrp informix $ARCHIVELINK
exec ln -fs $ARCHIVELINK $env(ARCHIVEFILE)
}
#
# Perform Informix Archive
# For every mount request received, create next archive file
# and re-create symbolic link for TAPEDEV file to point to it.
#
proc archive {} {
global env FILSEQ ARCHIVELINK EXITSTS
spawn ontape -s -L $env(ARCHIVELVL)
expect "press Return"
send "\\r"
expect {
"press Return" {
# exec compress $ARCHIVELINK &
incr DIRSEQ
incr FILSEQ
set ARCHIVELINK $env(ARCHIVEFILEDIRP)/$env(ARCHIVEBASE)$FILSEQ
exec touch $ARCHIVELINK
exec chmod 660 $ARCHIVELINK
exec chgrp informix $ARCHIVELINK
exec ln -fs $ARCHIVELINK $env(ARCHIVEFILE)
send "\\r"
exp_continue
}
"Error" {
set EXITSTS 2
}
"Archive failed" {
set EXITSTS 3
}
"Program cancelled" {
set EXITSTS 4
}
"Program over." {
# exec compress $ARCHIVELINK &
exec rm -f $env(ARCHIVEFILE)
exec touch $env(ARCHIVEFILE)
exec chmod 660 $env(ARCHIVEFILE)
exec chgrp informix $env(ARCHIVEFILE)
}
}
}
#
# Main Expect Program
#
global EXITSTS
set timeout -1
archive_setup
archive
exit $EXITSTS
---------------------------------------------------------------
HTH,
Paul Mosser
-----Original Message-----
From: t.chenus@imedia.com [mailto:t.chenus@imedia.com]
Sent: Wednesday, May 24, 2000 3:34 AM
To: informix-list@iiug.org
Subject: Using expect with ontape, onunload.
Hi,
I'm planning to use "expect" program to perform ontape and onunload jobs on
disks. Do you have ever seen a place somewhere where we can find generic
expect scripts to peform these jobs.
Thanks,
--
Thierry Chenus COFINOGA
System Administrator Tel: +33 (5) 56 55 75 39
Oracle DBA T.Chenus@cofinoga.fr