Recently I was writing a simple WLST script to monitor a weblogic domain. After a lot of tests and thoughts I develop a decent script that satisfy my monitor needs. While writing the script I wrote a few functions that I use them a lot. So, I think why not to add them in standard WLST commands of WLST, in order to be available whenever run WLST.
How can you add custom WLST commands in WLST??
The solution is very simple. You write your custom functions to one or more ‘.py’ script(s) and save them to ‘WL_HOME/common/wlst/lib’ directory. Any file added to this directory will be compiled automatically from WLST and will be imported by WLST when started. See the next simple example.
HelloLib.py
def HelloCmd(): print 'Hello dude'
Now, you can call this function in WLST offline mode like this:
wls:/offline>HelloLib.HelloCmd()
Hope it helps,
Adrianos Dadis
–
Democracy Requires Free Software.