PL/SQL invoking a korn shell

They have: 117 posts

Joined: Feb 2002

Arghhh... I'm going crazy with this and hope somebody has an answer.

We have a kornshell script that invokes Oracle reports to generate a number of pdf files. We would like to call that script via a URL from a webpage (press a button on a webpage and all these pdfs get generated and moved hither and yon).

The kornshell runs fine from the command line, but when it gets called via a URL it chokes. We were getting an error right at the start of the script saying DISPLAY was giving us problems. I think DISPLAY is a function in the X Winfows library. Then again, it might be a permissions problem.

First we tried to set the ENV for the kornshell (we thought that might be where the DISPLAY error was coming from). No go. Then I tried to get around that by calling a perl script which used SYSTEM() to invoke the shell and then the script -- but alas, that just led to different errors.

Anybody in here know an answer or direction we should be looking at?

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

How do you run this successfully? Are you in an X-Windows environment? Or can you run it fine from an SSH connection?

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

It is either one of two things or both:

  • Permissions - try logging into the system as the same user that is being used by the webserver and running the script. You might also try outputting the file to a chmoded 777 directory (just for test purposes). This will eliminate permissions as being the problem.
  • Make Korn the default shell for the same user as above.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

They have: 117 posts

Joined: Feb 2002

We're in the x-windows environment when we run it from the command line. The ksh script starts by reading the ENV file and that is where the script called by a URL appears to keel over. My first guess was that the script, when called from a URL, wasn't running the ksh script inside the Korn Shell and that's where it got lost. That's why I tried the intermediate Perl script, because I thought that I would be able to invoke the shell when I called it via system.

when I run it I'm back to the same error: DISPLAY=mantaray:0.0: is not an identifier

Am I correct in thinking that DISPLAY is part of xlib?

They have: 117 posts

Joined: Feb 2002

mairving,

Ya know... I never did check to see if the directory it is being output to is 777. It is probably 755. I'll check that. I'll also check into which shell the webserver user defaults to. Thanks.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Well, perhaps try faking the ENV. I had dificulty calling lynx from apache on some systems. I ended up doing this:
`LYNX_TEMP_SPACE=/tmp; export LYNX_TEMP_SPACE; lynx -dump http://example.com 1>/dev/null 2>&1`'What you'd need to do, is echo $DISPLAY from inside X-Windows to find out what a correct value is.

Mark Hensler
If there is no answer on Google, then there is no question.

They have: 117 posts

Joined: Feb 2002

Hey, I want to thank you guys who offered help. We actually ended up implementing it in a slightly different way. We're using Util_File to generate the kornshell on the fly. Then we invoke that script by calling it with a Java stored procedure with a PL/SQL wrapper. It gives us the advantage of using both unix and oracle's security mechanisms.

Eh, you've heard of extreme programming, we're perfecting the next great idea -- Rube Goldberg programming. Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.