Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
How to get envirinment variable from multiple servers using perl



Nithya
New User

Oct 10, 2014, 8:55 AM


Views: 44177
How to get envirinment variable from multiple servers using perl

Hi Team,

I have written script to get the environment variable as input and list some files.
-> cat env.pl
#!/usr/bin/perl
$x=`ssh testserver ls -l $ENV{TNS_ADMIN}/tnsnames.ora`;
print $x;

it is not working fine. Throwing error. It is throwing error as below. It is not taking the output of $ENV{TNS_ADMIN} in testserver. Please help me. It is urgent.
./env.pl <http:/http://env.pl//>
cat: 0652-050 Cannot open /tnsnames.ora.


Code
[ksnithyaaix@gmail.com] 


(This post was edited by Nithya on Oct 10, 2014, 9:36 AM)


Laurent_R
Veteran / Moderator

Oct 10, 2014, 10:20 AM


Views: 44172
Re: [Nithya] How to get envirinment variable from multiple servers using perl

It seems that the $TNS_ADMIN environment variable is not defined when you log with ssh. Maybe you have to source an Oracle configuration script before. I have the feeling that this question has little to do with Perl and more with Unix and Oracle configuration scripts.

Did you try using ssh manually, not in a Perl script?


Nithya
New User

Oct 10, 2014, 10:55 AM


Views: 44171
Re: [Laurent_R] How to get envirinment variable from multiple servers using perl

Hi Sir, I tried manually also it is not working. even i tried to get common environment variable also. It also not working.


Laurent_R
Veteran / Moderator

Oct 11, 2014, 10:09 AM


Views: 44112
Re: [Nithya] How to get envirinment variable from multiple servers using perl

This confirms that this is not really a Perl problem, but a configuration issue in your Unix/Linux (whatever) and Oracle set up. It will probably be next to impossible to help you without access to the servers. If you can, ask some help from your system admins and DBAs.