views:

297

answers:

2

Our application has a couple of shell scripts that are called from web-based Oracle Forms 10g, running on multiple Solaris 10 servers. We've discovered recently that the shell scripts are not running with the full permissions of the OAS user account that runs the forms. I added a echo User is $USER command to one script to display the Solaris user name, and it displayed just User is. When I used the id command instead, it did display that it was running as the correct user.

So, any thoughts on how to get the shell script to know who it is so it can read the files?

The aforementioned admin guys have double-checked everything they can think of, and swear up and down that everything is installed exactly the same as on all the other servers. The shell script is called using a HOST command from the forms.

We're on Forms 10g, Solaris 10, Oracle 10.1.0.4.2, and the Solaris account is running a ksh shell.

Thanks, Dan

Edit: Removed all the stuff about reports, as that problem was solved, but I am still interested if anybody knows why the shell scripts called from Forms via HOST command don't get a full login.

Update: Here is the argument passed to the HOST command (yes, the argument is 3 lines with line feeds):

exec > /u01/app/swms/forms/edoc_stage/Z05273_tibco_edoc.log
exec 2>&1
/u01/app/swms/forms/edoc_stage/tibco_edoc.sh DMSPV01\^NTSTE101 SWMSeDocTIBCO-d1 XXXXXX 082200413

I originally tried just calling the script, like the last line of the argument, but wasn't getting anywhere, so I copied what another script call was doing and modified it. That's where the first two lines came from.

And here's the script itself. I had to add the 3 lines starting with PATH=/usr/bin to get the .profile to execute. What I want to know is why that was necessary: why doesn't the shell do that automatically?

#!/bin/ksh

PATH=/usr/bin
USERNAME=`id | cut -d'(' -f2 | cut -d')' -f1`
. ~$USERNAME/.profile

TIBCO_HOME=${ORACLE_HOME}/forms/java
JAVA_HOME=/usr/java

CLASSPATH=${CLASSPATH}:${TIBCO_HOME}
CLASSPATH=${CLASSPATH}:${TIBCO_HOME}/PVIntegration.jar
CLASSPATH=${CLASSPATH}:${TIBCO_HOME}/wsdl4j-1.5.1.jar
CLASSPATH=${CLASSPATH}:${TIBCO_HOME}/saaj.jar
CLASSPATH=${CLASSPATH}:${TIBCO_HOME}/log4j-1.2.8.jar
CLASSPATH=${CLASSPATH}:${TIBCO_HOME}/jaxrpc.jar
CLASSPATH=${CLASSPATH}:${TIBCO_HOME}/commons-logging-1.0.4.jar
CLASSPATH=${CLASSPATH}:${TIBCO_HOME}/commons-discovery-0.2.jar
CLASSPATH=${CLASSPATH}:${TIBCO_HOME}/axis.jar
CLASSPATH=${CLASSPATH}:${TIBCO_HOME}/activation.jar
CLASSPATH=${CLASSPATH}:${TIBCO_HOME}/mailapi.jar
CLASSPATH=${CLASSPATH}:${TIBCO_HOME}/WSProxy.jar
CLASSPATH=${CLASSPATH}:${TIBCO_HOME}/xmlsec-1.4.2.jar
CLASSPATH=${CLASSPATH}:${TIBCO_HOME}/wss4j-1.5.5.jar
CLASSPATH=${CLASSPATH}:${TIBCO_HOME}/Config.properties

export CLASSPATH

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${TIBCO_HOME}
export LD_LIBRARY_PATH

${JAVA_HOME}/bin/java -Xms128m -Xmx256m com.aps.ecm.clients.ECMClient $1 $2 $3 $4
+1  A: 

A shell can be invoked as either a "login shell" or a "non-login shell". Sounds like the shell that the Oracle Forms invoke are non-login shells (probably because the shell is not connected to stdin in a tty). It could also be done purposely to explicitly prevent things like the .profile (or .cshrc or .bash_profile) from being sourced. Users can put all sorts of output in their .prfiles that may trip up the execution of a script.

Marc Bernstein
That would certainly explain it. I don't suppose you have any idea how to make Forms invoke a login shell? Or should I just keep doing it the way I am now, since it seems to be working?
AndyDan
I'd keep doing it the way you are with the id command. I do the exact same thing in my shell scripts.
Marc Bernstein
Thanks, Marc! I was starting to give up hope that any one would provide any actual answers.
AndyDan
A: 

Hi,

I am not sure how this is going to help you this late. But when I had this issue, I did a lot of research and finally could trace the issue to the version of rsh, solaris invoke by default; the kerberos version (/usr/kerberos/bin/rsh). I then changed it to /usr/bin/rsh and it worked!.

Regards

Arun

Arun Samuel
We don't have a /usr/kerberos directory on our servers. I searched everything under /usr, and only found one ksh that could be called, /usr/bin/ksh.Thanks, anyway!
AndyDan
Hi Andy, Apologies for not visiting this site frequently. But I was mentioning about rsh not ksh! I hope its not a typo...
Arun Samuel