List Info

Thread: Running Perl from Oracle




Running Perl from Oracle
country flaguser name
United States
2008-03-17 13:04:55

I have a Perl program that calls the local UNIX ssh command, and ssh's into another system and excites a command. It takes the output and copies it back and put it in a file.

"my arr = qx(ssh lms$host $lic_quorum_cmd);
Print OUT "arr";

It works fine when run as UNIX command line. But when I run it out of Oracle it doesn't seem to be able to find commands. Like the PATH variable isn't there. Can someone point me in the correct direction to fix this?

-----
Don Dukelow
HP License Team
Hewlett-Packard Company
Tel: 810-728-3388
e-mail: dukelow%40hp.com">dukelowhp.com

__._,_.___
.

__,_._,___
Re: Running Perl from Oracle
country flaguser name
United States
2008-03-17 13:58:05

--- In perl-beginner%40yahoogroups.com">perl-beginneryahoogroups.com, "Dukelow, Don" <dukelow...> wrote:
&gt;
> I have a Perl program that calls the local UNIX ssh command, and
ssh's into another system and excites a command. It takes the output
and copies it back and put it in a file.
&gt;
> "my arr = qx(ssh lms$host $lic_quorum_cmd);
> Print OUT "arr";
>
> It works fine when run as UNIX command line. But when I run it out
of Oracle it doesn't seem to be able to find commands. Like the PATH
variable isn't there. Can someone point me in the correct direction
to fix this?

1. You may want to have full paths in your script:

my $ssh = '/usr/bin/ssh'; # or wherever it is in your system
my arr = qx($ssh ...);

2. set PATH in your script

$ENV{PATH} = join(':', $ENV, '/bin', '/usr/bin');

There are probably other ways too, like setting .profile (or
.bash_profile) of that user, which Oracle is executing stuff as for you.

/sandy
http://myperlquiz.com/

__._,_.___
.

__,_._,___
Re: Running Perl from Oracle
country flaguser name
United States
2008-03-17 14:15:28

Don,

I wonder if this is related to the userid that Oracle is running out
of. The easiest approach might be to set PATH to what it needs to be
for this program.

hth,
Marty

At 02:04 PM 3/17/2008, Don Dukelow wrote:
&gt; I have a Perl program that calls the local UNIX ssh command, and
> ssh's into another system and excites a command. It takes the
> output and copies it back and put it in a file.
&gt;
>&quot;my arr = qx(ssh lms$host $lic_quorum_cmd);
>Print OUT "arr";
>
&gt; It works fine when run as UNIX command line. But when I run it
> out of Oracle it doesn't seem to be able to find commands. Like
> the PATH variable isn't there. Can someone point me in the correct
> direction to fix this?

--
Marty Landman, Face 2 Interface Inc. 845-679-9387
Drupal Development Blog: http://drupal.face2interface.com/
Free Database Search App: http://face2interface.com/Products/FormATable.shtml

__._,_.___
.

__,_._,___
RE: Running Perl from Oracle
country flaguser name
United States
2008-03-20 15:22:00

The PATH variable for Oracle is set correctly, but when I run the Perl script out of Oracle it doesn't pick up all of the everiment variables that a normal Oracle login has. The %ENV hash is almost empty, with a very short PATH entry. I ran the program manually and put out all the entries to a file. Now when I run the program under Oracle I source all the entries back into the %ENV hash. I've checked and they are are there. But it still doesn't work, it goes through the motions but doesn't do anything.
The main thing my local Perl script does which is a Linux box is go out to a Sun server and excite a script and brings back the output.
$answer = qz(ssh lmsSystemName<mailto:lmsSystemName> /usr/local/bin/script);
I was wondering if it would be better to put output to a file and copy the file back to local system.

If anyone has better idea please let me know.

-----
Don Dukelow
HP License Team
Hewlett-Packard Company
Tel: 810-728-3388
e-mail: dukelow%40hp.com">dukelowhp.com

________________________________
From: perl-beginner%40yahoogroups.com">perl-beginneryahoogroups.com [mailto: perl-beginner%40yahoogroups.com">perl-beginneryahoogroups.com] On Behalf Of Marty Landman
Sent: Monday, March 17, 2008 3:15 PM
To: perl-beginner%40yahoogroups.com">perl-beginneryahoogroups.com
Subject: Re: [PBML] Running Perl from Oracle

Don,

I wonder if this is related to the userid that Oracle is running out
of. The easiest approach might be to set PATH to what it needs to be
for this program.

hth,
Marty

At 02:04 PM 3/17/2008, Don Dukelow wrote:
&gt; I have a Perl program that calls the local UNIX ssh command, and
> ssh's into another system and excites a command. It takes the
> output and copies it back and put it in a file.
&gt;
>&quot;my arr = qx(ssh lms$host $lic_quorum_cmd);
>Print OUT "arr";
>
&gt; It works fine when run as UNIX command line. But when I run it
> out of Oracle it doesn't seem to be able to find commands. Like
>; the PATH variable isn't there. Can someone point me in the correct
> direction to fix this?

--
Marty Landman, Face 2 Interface Inc. 845-679-9387
Drupal Development Blog: http://drupal.face2interface.com/
Free Database Search App: http://face2interface.com/Products/FormATable.shtml

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )