Networker

[Networker] Can't get nsradmin to work via Perl script

2006-04-27 19:00:04
Subject: [Networker] Can't get nsradmin to work via Perl script
From: George Sinclair <George.Sinclair AT NOAA DOT GOV>
To: NETWORKER AT LISTSERV.TEMPLE DOT EDU
Date: Thu, 27 Apr 2006 18:58:03 -0400
Hi,

I'm trying to run nsradmin via a Perl script (see below). The script doesn't use a 
temporary file. I notice that *unless* I specify a "show attribute" command 
like:

print WTRFH "show name\n";

the script just hangs. It doesn't seem to like just "show\n" by itself. This 
also causes the script to hang. I want all the attributes to get printed. I even tried:

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?

Thanks.

George



#!/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);

# get the results.
my @output = <RDRFH>;

print @output;

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
wit 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

<Prev in Thread] Current Thread [Next in Thread>