Saving changes to the script library
The script library provides Jython script procedures to assist in automating your environment. You can save changes to the master configuration repository, disable the automatic saving of configuration changes, or discard configuration changes.
About this task
A biblioteca de scripts fornece um conjunto de procedimentos para automatizar
as funções mais comuns de administração de servidor de aplicativos.
Há três maneiras
de utilizar a biblioteca de script Jython.
- Execute scripts da biblioteca de scripts Jython no modo interativo com a ferramenta
wsadmin. Você pode ativar a ferramenta wsadmin e executar scripts individuais incluídos
na biblioteca de scripts utilizando a seguinte sintaxe:
wsadmin>AdminServerManagement.createApplicationServer("myNode", "myServer", "default")
- Utilize um editor de texto para combinar diversos scripts da biblioteca de scripts
Jython, conforme exibido na seguinte amostra:
Salve o script customizado e execute-o na linha de comandos, conforme demonstra a seguinte sintaxe:# # My Custom Jython Script - file.py # AdminServerManagement.createApplicationServer("myNode", "Server1", "default") AdminServerManagement.createApplicationServer("myNode", "Server2", "default") # Use one of them as the first member of a cluster AdminClusterManagement.createClusterWithFirstMember("myCluster", "APPLICATION_SERVER", "myNode", "Server1") # Add a second member to the cluster AdminClusterManagement.createClusterMember("myCluster", "myNode", "Server3") # Install an application AdminApplication.installAppWithClusterOption("DefaultApplication", "..\installableApps\DefaultApplication.ear", "myCluster") # Start all servers and applications on the node AdminServerManagement.startAllServers("myNode")
bin>wsadmin -language jython -f path/to/your/jython/file.py
- Utilize o código da biblioteca de scripts Jython como sintaxe de amostra para gravar scripts customizados. Cada exemplo de script na biblioteca de scripts demonstra boas práticas para escrever scripts wsadmin. O código da biblioteca de script está localizado no diretório app_server_root/scriptLibraries. Nesse diretório, os scripts são organizados em subdiretórios, de acordo com a funcionalidade. Por exemplo, o subdiretório app_server_root/scriptLibraries/application/V70 contém procedimentos que executam tarefas de gerenciamento de aplicativo que são aplicáveis à Versão 7.0 e posterior do produto. O subdiretório V70 nos caminhos da biblioteca de scripts não significa que os scripts contidos nesse diretório são scripts da Versão 7.0.
The script library saves configuration changes to the master configuration repository by default when each script procedure completes. You can disable or enable the automatic saving of configuration changes with the AdminUtilities.configureAutoSave() script procedure. You can alternatively save changes to the configuration before leaving the wsadmin process by using the AdminConfig.sav() command. You can discard configuration changes with the AdminConfig.reset() command.
CAUTION:
If
you disable the autosave procedure, call script procedures, then enable
the autosave procedure, automatic saving of script procedures in the
same wsadmin process does not occur until you call another script
procedure.