automatic ontape backup-problem
Posted in 2000
Dariusz Durka asked how to run ontape -s -L 0 from cron when it prompts to mount a tape. Ivan Raikov suggested piping echo into ontape. Timothy Brown posted a ksh script feeding an empty here-document to ontape for the crontab. Bill Border noted this fails for multi-tape backups and pointed to his Perl script using named pipes at IIUG.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Topics: Backup & Restore
Hello everybody ! How starting an automatic backup from crontab Ontape -s ?L 0 when prompts Please mount tape 1 on /dev/rmt0 and press Return to continue Dariusz Durka email : darekd@polsteam.com.pl
Perhaps `echo | ontape -c`?
"Dariusz Durka" <darekd@polsteam.com.pl> writes:
> Hello everybody !
>
> How starting an automatic backup from crontab
> Ontape -s ?L 0
>
> when prompts
>
> Please mount tape 1 on /dev/rmt0 and press Return to continue
>
>
> Dariusz Durka email : darekd@polsteam.com.pl
>
--
Ivan Raikov
800 Fowler Street, Atlanta, Georgia 30313-2554
Phone: 404-892-6579 x. 106
Email: raikov@cc.gatech.edu
Hi Dariusz,
Dariusz Durka wrote in message <01bff725$b5264ce0$0a08029e@pc810>...
>
>Hello everybody !
>
>How starting an automatic backup from crontab
>Ontape -s ?L 0
>
>when prompts
>
>Please mount tape 1 on /dev/rmt0 and press Return to continue
>
>
> Dariusz Durka email : darekd@polsteam.com.pl
>
You might want to try something like the following:
First, create a script (ie /informixdirectory/level_0_backup.sh) and add the
following:
#!/usr/bin/ksh
export INFORMIXSERVER=servername
export INFORMIXDIR=/informixdirectoryexport SQLHOSTS=$INFORMIXDIR/etc/sqlhostsfile
date >> $INFORMIXDIR/level_0_backup.out
$INFORMIXDIR/bin/ontape -s -L 0 <<EOF >>$INFORMIXDIR/level_0_backup.out 2>&1
EOF
Then, give informix ownership and make it executable:
chown informix:informix /informixdirectory/level_0_backup.sh
chmod 660 /informixdirectory/level_0_backup.sh
Finally, place it in the informix crontab file:
crontab -e
(add line: 0 17 * * * /informixdirectory/level_0_backup.sh >/dev/null)
Note, if the level 0 backup requires more than one tape, this script will
send the "please mount next..."
to the output (ie /informixdirectory/level_0_backup.out) periodically until
you mount the next tape,
and then it will hit return for you to allow the backup to continue.
I didn't check the syntax, but you could do something like this.
Hope this helps,
-Tim
These primitive methods will work as long as your backup
does not fill the tape. Years ago I donated a script to
IIUG that deals with multiple tapes. It is written in Perl
and used Named Pipes to communicate with ontape. In a new
Informix Admin book that is coming out soon (Informix
Handbook?) the authors requested my permission to put it
on the CD that comes with the book. It can be found at:
http://www.iiug.org/software/index_DBA.html
--
Bill Border
Agilent Technologies
bb22@uswest.net
Affordable, Effective WWW-Based Informix/Oracle DB monitor:
http://dbamon.com
Timothy A. Brown wrote in message
<3980bb37$0$61816$53a6afc1@news.erinet.com>...
>Hi Dariusz,
>
>Dariusz Durka wrote in message <01bff725$b5264ce0$0a08029e@pc810>...
>>
>>Hello everybody !
>>
>>How starting an automatic backup from crontab
>>Ontape -s ?L 0
>>
>>when prompts
>>
>>Please mount tape 1 on /dev/rmt0 and press Return to continue
>>
>>
>> Dariusz Durka email : darekd@polsteam.com.pl
>>
>
>You might want to try something like the following:
>
>First, create a script (ie /informixdirectory/level_0_backup.sh) and add
the
>following:
>#!/usr/bin/ksh
>export INFORMIXSERVER=servername
>export INFORMIXDIR=/informixdirectory>export SQLHOSTS=$INFORMIXDIR/etc/sqlhostsfile
>date >> $INFORMIXDIR/level_0_backup.out
>$INFORMIXDIR/bin/ontape -s -L 0 <<EOF >>$INFORMIXDIR/level_0_backup.out
2>&1
>EOF
>
>Then, give informix ownership and make it executable:
>chown informix:informix /informixdirectory/level_0_backup.sh
>chmod 660 /informixdirectory/level_0_backup.sh
>
>Finally, place it in the informix crontab file:
>crontab -e
>(add line: 0 17 * * * /informixdirectory/level_0_backup.sh >/dev/null)
>
>Note, if the level 0 backup requires more than one tape, this script will
>send the "please mount next..."
>to the output (ie /informixdirectory/level_0_backup.out) periodically until
>you mount the next tape,
>and then it will hit return for you to allow the backup to continue.
>
>I didn't check the syntax, but you could do something like this.
>Hope this helps,
>-Tim
>
>
>
>
>