WAS v8.5 > Script the application serving environment (wsadmin) > Use properties files to manage system configurationApplying properties files using wsadmin.sh
Use this topic and wsadmin to apply modified configuration properties to the environment using properties files.
Use the extractConfigProperties command in the PropertiesBasedConfiguration command group to extract the properties files of interest. Use a text editor to modify one or more values in the properties file.
Use the validateConfigProperties command in the PropertiesBasedConfiguration command group to validate the modified properties file before applying the file to your configuration. We cannot apply a z/OS operating system properties file directly to a distributed operating system. Similarly, we cannot apply a distributed operating system properties file directly to a z/OS operating system. gotcha
We can also use interactive mode with these commands, as the following syntax demonstrates:
AdminTask.commandName('-interactive')
- Modify one or more properties and apply the properties file to the configuration.
- Start the wsadmin scripting tool.
- Modify the properties of interest.
In the following properties file, use a text editor to change the value of the enableSFSB property:
# # SubSection 1.0 # EJBContainer # ResourceType=EJBContainer ImplementingResourceType=EJBContainer ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:ApplicationServer= ID#ApplicationServer_1:EJBContainer=ID#EJBContainer_1AttributeInfo=components # # #Properties # EJBTimer={} #ObjectName*(null) name=null defaultDatasourceJNDIName=null inactivePoolCleanupInterval=30000 #long passivationDirectory="${USER_INSTALL_ROOT}/temp" enableSFSBFailover=true #boolean server=null parentComponent=WAS, Network Deployment Server EnvironmentVariablesSection # # #Environment Variables #Thu Apr 17 14:10:31 CDT 2008 hostName2=* hostName1=localhost cellName=IBM-49F7FB781FECell07 nodeName=IBM-49F7FB781FECellManager07 hostName=IBM-49F7FB781FE.austin.ibm.com serverName=dmgr enableSSB=true- Apply the modified properties to your configuration.
Use the applyConfigProperties command to apply the properties file to the configuration, as the following Jython example demonstrates:
AdminTask.applyConfigProperties('[-propertiesFileName ejbcontainer.props]')
- Use additional user modified variables to modify the configuration.
- Start the wsadmin scripting tool.
- Use additional variables to modify the enableSFSBFailover property of the EJB container, changing the value from true to false.
In the following properties file, modify the enableSFSBFailover property by specifying the value as the !{enableSSB} variable. We can use the variable in the section header or in the properties part of the section. Also, one property value can contain multiple variables as shown for ResourceId.
# # SubSection 1.0 # EJBContainer # ResourceType=EJBContainer ImplementingResourceType=EJBContainer ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:ApplicationServer=ID#ApplicationServer_1: EJBContainer=ID#EJBContainer_1 AttributeInfo=components # # #Properties # EJBTimer={} #ObjectName*(null) name=null defaultDatasourceJNDIName=null inactivePoolCleanupInterval=30000 #long passivationDirectory="${USER_INSTALL_ROOT}/temp" enableSFSBFailover=!{enableSSB} #boolean server=null parentComponent=WAS, Network Deployment Server EnvironmentVariablesSection # # #Environment Variables #Thu Apr 17 14:10:31 CDT 2008 hostName2=* hostName1=localhost cellName=IBM-49F7FB781FECell07 nodeName=IBM-49F7FB781FECellManager07 hostName=IBM-49F7FB781FE.austin.ibm.com serverName=dmgr enableSSB=true- Apply the modified properties to your configuration.
Use the applyConfigProperties command to apply the properties file to the configuration, as the following Jython example demonstrates:
AdminTask.applyConfigProperties('[-propertiesFileName ejbcontainer.props]')
- Modify the configuration by applying a properties file and a variable map.
- Start the wsadmin scripting tool.
- Modify the enableSFSBFailover property of the EJB container, changing the value from true to false.
Modify the enableSFSBFailover property by specifying the value as the !{enableSSB} variable in a separate variable map file. Instead of specifying the variable in the section header or in the properties part of the section, create a separate variable map file. The following code displays a sample variable map file:
ejbprops.vars: # # #Environment Variables #Day Month 11 Time CDT Year hostName2=* hostName1=localhost cellName=myCell nodeName=myNode hostName=myhost.com serverName=myServer enableSSB=trueThe following code displays the corresponding properties file to apply to the configuration:
# # SubSection 1.0 # EJBContainer # ResourceType=EJBContainer ImplementingResourceType=EJBContainer ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:ApplicationServer=ID#ApplicationServer_1: EJBContainer=ID#EJBContainer_1 AttributeInfo=components # # #Properties # EJBTimer={} #ObjectName*(null) name=null defaultDatasourceJNDIName=null inactivePoolCleanupInterval=30000 #long passivationDirectory="${USER_INSTALL_ROOT}/temp" enableSFSBFailover=true#boolean server=null parentComponent=WAS, Network Deployment Server- Apply the modified properties to your configuration.
Use the applyConfigProperties command to apply the properties file and the variable map file to the configuration, as the following Jython example demonstrates:
AdminTask.applyConfigProperties('[-propertiesFileName ejbcontainer.props -variablesMapFileName ejbprops.vars]')
To verify the system made the changes to your configuration, extract the properties file from your configuration using the extractPropertiesFile command.
Subtopics
- Applying portable properties files across multiple environments
Use wsadmin to extract a properties file from one cell, modify environment-specific variables at the bottom of the extracted properties file, and then apply the modified properties file to another cell. Modifying environment-specific variables makes a properties file portable.
Related
Extracting properties files using wsadmin.sh
Validating properties files using wsadmin.sh
Create server, cluster, application, or authorization group objects using properties files and wsadmin scripting
Delete server, cluster, application, or authorization group objects using properties files
Create and deleting configuration objects using properties files and wsadmin scripting
Manage environment configurations with properties files using wsadmin.sh
Extracting properties files to troubleshoot the environment using wsadmin.sh
Manage servers and nodes with scripting
Reference:
PropertiesBasedConfiguration command group for AdminTask using wsadmin.sh