Passing Variables to EBS Start Scripts (without having them show up in the environment)

In earlier releases of Oracle E-Business Suite, many of the standard startup/shutdown scripts would accept a password as a command-line argument.  This gave us the ability to automate and/or script certain maintenance tasks.

E-Business Suite R12.1.3

In E-Business Suite R12.1.3, for example, you could start the appsTier with the following:

cd ${ADMIN_SCRIPTS_HOME}

./adstrtal.sh apps/${APPSPW}

E-Business Suite R12.2

When we get to E-Business Suite R12.2, the startup procedure is pretty much the same, but the command line arguments are no longer there.  To get around this, we’re told to pass things on the command line u sing the echo command.  Per MOS 1902776.1, the recommendation is:

cd ${ADMIN_SCRIPTS_HOME}

{ echo "APPS" ; echo ${APPSPW} ; echo ${WLADMINPW} ; }|\
./adstrtal.sh @ -nopromptmsg

Although the command line is complicated, it works well. 

The Problem

However, the variables that are set will persist in the Unix environment of the adstrtal.sh script (and all processes that is spawns).

Test Script

So, to figure this out (and test our approaches), we have this simple test script:

#!/bin/bash
echo -e "\n--------------------------------------------------\n"
echo -e "Variables:\n"
echo -e "\tAPPSPW:  ${APPSPW}"
echo -e "\tAPPSUN:  ${APPSUN}\n"

echo -e "Full ENV DUMP in /tmp/env.txt"
echo -e "Searching through /tmp/env.txt for APPSUN and APPSPW"
echo -e "\n--------------------------------------------------\n"
env >/tmp/env.txt

grep "APPSPW\|APPSUN" /tmp/env.txt
echo -e "\n--------------------------------------------------\n"

We can set these variables and run the script normally:

{ echo ${APPSUN} ; echo ${APPSPW} ; }|./test.sh

--------------------------------------------------

Variables:

   APPSPW:  appspw
   APPSUN:  apps

Full ENV DUMP in /tmp/env.txt
Searching through /tmp/env.txt for APPSUN and APPSPW

--------------------------------------------------

APPSPW=appspw
APPSUN=apps

--------------------------------------------------

As you can see, the ${APPSUN} and ${APPSPW} variables are in the text file.

However, when we run the script with a different command line, we get a different result.

{ echo ${APPSUN} ; echo ${APPSPW} ; }|env -u APPSPW bash ./test.sh

--------------------------------------------------

Variables:

   APPSPW: 
   APPSUN:  apps

Full ENV DUMP in /tmp/env.txt
Searching through /tmp/env.txt for APPSUN and APPSPW

--------------------------------------------------

APPSUN=apps

--------------------------------------------------

The Solution

To get around that problem, we can actually DELETE the variables from the environment.

cd ${ADMIN_SCRIPTS_HOME}

{ echo "APPS" ; echo ${APPSPW} ; echo ${WLADMINPW} ; }|\
 env -u APPSPW -u SYSTEMPW -U WLADMINPW bash ./adstrtal.sh @ -nopromptmsg

The command line is even uglier. We still have ${APPSPW}, ${SYSTEMPW}, and ${WLADMINPW} in our shell, but, those variables are not inherited by the running EBS processes.

Leave a Reply

Your email address will not be published. Required fields are marked *