| Bascule 2005-07-27, 7:06 am |
| Hi All,
I've tried searching for help on this to no avail so I'm going for a post. Any advice would be gratefully received!
I'm trying to automate a restore of a file using Legato Networker. Networker has a command called "recover" which when run from the command line like this:
recover -f -d e:\test_restore\ -a e:\test_restore_file.txt
will do a restore of the txt file from tape to disk and tell you how it's getting along like this:
Recovering 1 file from E:\ into E:\test_restore
Requesting 1 file(s), this may take a while...
E:\test_restore\test_restore_file.txt
E:\test_restore\test_restore_file.txt: file exists, overwriting
Received 1 file(s) from NSR server `<servername>`
Recover completion time: Wed Jul 27 13:01:41 2005
There is a pause of a minute ore two after "this may take a while..." while Networker finds the file on the tape.
My first attempt at doing this from Perl is:
open my $RECOVERIN, '-|', "recover -f -d e:\\test_restore\\ -a e:\\test_restore_file.txt 2>&1" or die "Cannot open recover process for read :$!";
while (<$RECOVERIN> ) {
print scalar(localtime)," : ", $_;
}
I believe that "open" shouldn't wait for the command to finish before the script continues. However, none of the output from the command is returned to the script until it has completed. I think this is an issue with windows or with the command (or both) but I hoped I might find a way round it from within Perl.
If I run the command from a command prompt and redirect the output to a file the same happens. Nothing goes to the file until the command has finished. So this is not specifically a Perl issue but I hoped Perl might have a solution to it? It's as if the command or windows is changing its behaviour because it's talking to a file (or filehande) instead of a terminal?
Any suggestions?
Besr Rgds,
Andy |