Perl script for running OnTape, Someone???
Posted in 2005
Topics: Backup & Restore
Hi, Would be thankful if someone could provide me with a Perlscript for OnTape, or explain how to call OnTape from within Perl. I try to solve it with a system() call, but get stuck on the question when OnTape asks for tapedrive,,, /Christian
Diveman wrote:
> Hi,
>
> Would be thankful if someone could provide me with a Perlscript for
> OnTape,
> or explain how to call OnTape from within Perl.
>
> I try to solve it with a system() call, but get stuck on the question
> when OnTape asks for tapedrive,,,
>
> /Christian
You are better off using Expect/TCL to manage an ontape session. Expect is
a rule based scripting language built over TCL which is designed for
controlling equipment and other software.
Alternatively, my ALARMPROGRAM utility manages sessions of ontape in 'C'.
It includes a response parser to read the prompts from ontape and reply.
To do this in Perl you will have to run ontape as a pipe. Read the prompts
from the read side of the pipe and reply accordingly writing to the write
side of the pipe. You'll have to handle the possibility that ontape may not
prompt you and your script will hang until the ontape completes and the pipe
closes returning an error or use the poll() or select() system calls with a
timeout. This is easier in Expect which can run the pipe asynchronously.
Art S. Kagel