automating archives on HPUX
Posted in 1999
Topics: General Discussion
Anybody have a script or other means of running a level 0 archive automatically each night? I only need one tape so it can be unattended. A novice question I know but we all start somewhere. Many Thanks. -Peter
Use the UNIX cron facility to kick off the job, more info:
man crontab
man cron
I believe ontape is interactive, so the script should probably contain a Here
document, which is used for executing command that expect input. The trick is to
run the ontape archive once from the command line, noting exactly what input is
needed to prompts - you will not have to use the ontape prompts, thought. For
example if ontape just asks you to mount the tape and press return, then your
script would look something like
ontape -s -L 0 <<!
!
Be careful with the Here Document:
o The second ! must be on a line by itself - if, for example, you put a space after
it, it doesn't work.
o <<! is one token and cannot have spaces: wrong:
<< !
o That is a a blank line in the Here Document - it is really a newline which is fed
to the standard input of the ontape command.
P F SIEGEL wrote:
> Anybody have a script or other means of running a level 0 archive automatically
> each night? I only need one tape so it can be unattended. A novice question I
> know but we all start somewhere. Many Thanks.
> -Peter
I run the following script for a level 0 archive via cron. Please note that it assumes that I have an environment var called LOGDIR. John S. --------------------------------- #!/bin/sh . config/profile LOGFILE=$LOGDIR/ontape.log echo "Start Production Database Backup 0 at "`date` >> $LOGFILE $INFORMIXDIR/bin/ontape -s >> $LOGFILE <<! 0 ! echo "End Production Database Backup 0 at "`date` >> $LOGFILE echo "Start Production logical log Backup at "`date` >> $LOGFILE $INFORMIXDIR/bin/ontape -a >> $LOGFILE <<! 0 y ! echo "End Development logical log Backup at "`date` >> $LOGFILE ---------------------------------