print WTRFH ". type:NSR client\n";
print WTRFH "print\n";
It still only works if I specify the attribute on the show command fist. This
makes no sense as it works fine within nsradmin. Also, it works if I create a
temp file with the following:
print type:NSR client
and then I run nsradmin -s server -i temp_file
Isn't my script doing the same thing????
Any ideas?
Not too many. Your script worked just fine without modifications
(except the server name) on my test server.
But...
#!/free/bin/perl
my $program = "nsradmin";
@args = ("-s", "orion", "-i", "-");
use IPC::Open2;
my $pid = open2(\*RDRFH, \*WTRFH, "$program", @args) or die "can't open pipe to
$program: $!";
# Send commands to nsradmin.
# print WTRFH "show name\n";
print WTRFH "print type:NSR client\n";
close (WTRFH);
waitpid($pid, 0);
Why are you waiting on a process that you're not done interacting with?
For this short of a program, you probably shouldn't wait on it at all.
While I'd expect problems with a longer program, I wouldn't think that
what you're doing would be affected. Still I'd get rid of that line.
# get the results.
my @output = <RDRFH>;
print @output;