Weblogic WLST – Accessing OS variables

As with all thing wlst, almost everything you can do in python you can do in wlst.

Below is just a simple example of accessing host variables from inside of weblogic.

[sa-weblogic@cmhldecomadm01 Middleware]$ export FOO="BAR"
[sa-weblogic@cmhldecomadm01 Middleware]$ ./Oracle_Home/oracle_common/common/bin/wlst.sh

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline> print java.lang.System.getenv('FOO')
BAR
wls:/offline> for p in java.lang.System.getenv('PATH').split(":"):
...  print p
...
/u01/app/oracle/Middleware/Oracle_Home/wlserver/server/bin
/u01/app/oracle/Middleware/Oracle_Home/oracle_common/modules/org.apache.ant_1.7.1/bin
/usr/lib/jvm/java-1.7.0-oracle-1.7.0.45.x86_64/jre/bin
/usr/lib/jvm/java-1.7.0-oracle-1.7.0.45.x86_64/bin
/usr/local/bin
/bin
/usr/bin
/usr/local/sbin
/usr/sbin
/sbin
/opt/weblogic/bin
/u01/app/oracle/Middleware/Oracle_Home/oracle_common/modules/org.apache.maven_3.0.4/bin
wls:/offline>

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.