JACL script to validate and save configuration

IBM WebSphere Application Server
# --- Validate Configurations
proc save_val {} {
	puts " "
	puts "express.control: -- Checking Current Status ..."
	set val_stat [$AdminConfig validate]
	#$AdminConfig setValidationLevel high
	puts "express.control: -- $val_stat"
	puts "express.control: -- Checking for any unsaved changes ..."
	set val_query [$AdminConfig queryChanges]
	puts "express.control: -- $val_query"
	puts "express.control: -- Done."
#Proc Save the configuration
proc save_config {} {
	puts " "
	global ScriptLocation;  source "$ScriptLocation/Definitions.jacl"

	puts "********************************************************"
	puts "--            SAVE CONFIGURATION                      --"
	puts "*********************************************************"
	set save_stat [$AdminConfig getSaveMode]
	puts "express.control: -- Global Config Save Mode is : $save_stat "

	set val_mode [$AdminConfig getValidationLevel]
	puts "express.control: -- Global Validation Mode is : $val_mode "

	#$AdminConfig setSaveMode overwriteOnConflict
	#$AdminConfig setValidationLevel high
	#There are five validation levels: none, low, medium, high, or highest.
	#WASX7241I: There are no unsaved changes in this workspace.
	puts "express.control: -- saving following query changes."
	set val_query [$AdminConfig queryChanges]
	puts "express.control: -- changes found: $val_query "
	#set val_search [lsearch -exact $val_query WASX7241I:]
	#set index_value [lindex $val_query $val_search]
	#if { $index_value!="WASX7241I:"} {	
	puts "express.control: -- Start saving the configuration."

	if {[catch {$AdminConfig save} result]} {

   	puts " "
   	puts "express.control: -- Configuration save is not complete, exception = $result"
	puts "express.control: -- Resetting the configuration changes done for this session ..."
	set reset [$AdminConfig reset]
	puts " $reset "
	exit 0
	} else {
   	puts " "
   	puts "express.control: -- Configuration save is complete."
	#puts "express.control: -- No Config changes are found."
	#puts "express.control: -- No config save will be performed."
	#exit 0

In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.

Leave a Reply

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