Re: [Networker] capture recover command output
2008-10-30 12:10:34
On Thu, Oct 30, 2008 at 06:48:51AM -0400, ess07 wrote:
> I was finally able to get it to work. I used the following command in my perl
> script to get it to work.
>
> $output = `recover -d $destination -c $notesclient -t $nsrdate -a
> $restorepath 2>&1`;
>
The only drawback here is that you can't get partial information. If
the recover command does print lines every so often (and it might not
when there's no TTY), then you won't see them. This command won't
return until the recover exits.
If it's worth it to you could do something like:
my $cmd = "recover -d $destination -c $notes client -t $nsrdate -a $restorepath
2>&1";
open (my $recover_out, "-|", $cmd) or die;
while (my $line = <$recover_out>)
{
... do what you want with output
... possibly printing it as well
}
> This was inside a loop then just printed the output variable to a file.
> I was finally able to send all the output to a file, but the only
> thing I didnt like was the output didnt get sent till that one
> particular recover was completed. Good enough though.
Don't forget to set $|=1 to turn on autoflush for items you print.
--
Darren
To sign off this list, send email to listserv AT listserv.temple DOT edu and
type "signoff networker" in the body of the email. Please write to
networker-request AT listserv.temple DOT edu if you have any problems with this
list. You can access the archives at
http://listserv.temple.edu/archives/networker.html or
via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER
|
|
|