Want to automate that process and others, but low on free cycles to study wsadmin?
No worries - here's a shortcut.
WebSphere has a handy Command Assistance feature that will display the equivalent scripting command of the last action you manually performed in the admin console. You can access Command Assistance via the Help box on the right-side of admin console pages.
So, next time you perform that manual task for the nth time - grab the equivalent scripting command (example shown below) and save that off to a *.py file to automate that task going forward.
Ok, I've copied the script and saved it off to a *.py file (e.g. myScript.py) - now what?
While WebSphere will generate the key aspects of the script, you may find it helpful to perform some small customizations. For instance, the script above expects my EAR file (name hidden) to be in the directory from which I run wsadmin. You may want to tweak that and that's easy enough to do. However, for test purposes, I can just $ cd over to my build directory and run the following command :
? <WEBSPHERE_PROFILE>/bin/wsadmin.sh -lang jython -f <PATH_TO_PY_SCRIPT>/myScript.pyIf you run the generated script, you'll notice a message at the end : No "save" was performed before the script exited ...
This is desired behavior. You can safely test your script before committing any "saves" to WebSphere administration.
Ready to perform the save action?
Simply add the following line to your script: AdminConfig.save()
Command Assistance affords you a low barrier to entry to automate repeat server administration functions. Help drive efficiencies within your organization.
- WebSphere 6.1 InfoCenter (Command Assistance)