1

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
2
  • Does the OAS account have the same shell (in /etc/passwd) on all servers, and the same .profile? Is $SHELL set? (Can't remember why I think that might be important). Is the script you're calling specifying which shell to run via #!/bin/ksh or similar? Does explicitly invoking your .profile in your script, or even just manually setting USER=$LOGNAME, make any difference? Are you using any other environment variables in the path to the file you're referencing? Might be helpful to see the argument you're passing to HOST, the script itself, and the error it produces. Commented Feb 19, 2010 at 9:46
  • The shell and the .profile is the same on all servers. $SHELL is set to /bin/ksh. The script does specify the shell at the top. Manually setting USER had no effect, but explicitly invoking the .profile does have the desired effect. The only environment variables that are being used without being explicitly set were PATH, CLASSPATH and LD_LIBRARY_PATH. I will update the question with the HOST command and it's argument, and the script. Commented Feb 22, 2010 at 20:06

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

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?
I'd keep doing it the way you are with the id command. I do the exact same thing in my shell scripts.
Thanks, Marc! I was starting to give up hope that any one would provide any actual answers.
0

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

2 Comments

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!
Hi Andy, Apologies for not visiting this site frequently. But I was mentioning about rsh not ksh! I hope its not a typo...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.