Re: Unattended ontape
Posted in 2004
The Awk part discards duplicate output lines, so the server doesn't "fill
its pants". However, you have just explained why I sometimes have to kill
the process.
"David Williams" <djw@smooth1.fsnet.co.uk> wrote in message
news:c618da$fgi$1@newsg2.svr.pol.co.uk...
>
> "Doug Lawry" <lawry@nildram.co.uk> wrote in message
> news:c60o2f$ch2$1@nntp0.reith.bbc.co.uk...
> > Your comments are of course quite correct: this does not support
multiple
> > tapes, but is fine for smaller databases. Any error is recorded but the
> > process aborts.
>
> If it prompts you for a new tape and stdin is not a terminal it will still
> in a tight loop doing repeated read calls clocking up 100% cpu and writing
> thousands of "put in another tape" message to stdout. Once saw this fill
up
> the root partition on a sun box..>300Mb file and it was still looping. Not
> sure but from a cursory glance this script will dump stdout to a) the
> screen b) if run from cron then /tmp or the root partition filling it!
>
>
> > Sounds like others are using "expect" for a more complete solution.
> >
> >
> > "Doug Lawry" <lawry@nildram.co.uk> wrote in message
> > news:c5on8e$iml$1@nntp0.reith.bbc.co.uk...
> >
> > > Some recent threads implied that you cannot use ontape unattended.
> > > I disagree! See Shell script below.
> > >
> > > Regards,
> > > Doug Lawry
> > > www.douglawry.webhop.org
> > >
> > >
> > > # Run an automated Informix "ontape" backup
> > >
> > > # Doug Lawry, 20/11/95
> > >
> > > case $1 in
> > > '') set -- 0 ;;
> > > [012]) ;;
> > > *) echo "Usage: $0 level (0-2)" ; exit 1 ;;
> > > esac
> > >
> > > AWK='NF > 0 && $0 != last {print ; last = $0}'
> > >
> > > exec echo | ontape -s -L $1 | tr '\\b' '\\n' | awk "$AWK"