wsadmin是IBM WebSphere提供的命令行管理工具浮梢,通過管理API接口與服務器交互着裹。在生產自動運維中需要通過非交互式直接執(zhí)行的命令來完成自動的應用部署和更新贷笛。通過研究钉嘹,發(fā)現提供的接口還是蠻豐富的助被,也確實可以不需要復雜的圖形界面手工交互才能部署應用蜕煌,大大簡化了運行過程派阱,提供了運維的效率。
wsadmin命令工具
wsadmin 工具的選項不區(qū)分大小寫斜纪。請不要傳遞空字符串來代替命令選項贫母。如果指定空字符串作為命令選項,那么 wsadmin 工具會顯示一般幫助信息盒刚。對 wsadmin 腳本客戶機使用以下命令行調用語法:
wsadmin [-h(help)][-?] [-c ][-p ][-profile ][-profileName ][-f ][-javaoption java_option][-lang language] [-wsadmin_classpath classpath][-conntype SOAP [-hosthost_name] [-portport_number] [-useruser ID] [-passwordpassword][-conntype JSR160RMI [-hosthost_name] [-portport_number] [-useruser ID] [-passwordpassword][-conntype RMI [-hosthost_name] [-portport_number] [-useruser ID] [-passwordpassword][-conntype IPC [-ipchosthost_name] [-portport_number] [-useruser ID] [-passwordpassword]?[-jobidstring][-tracefiletrace_file][-appendtracetrue/false][script parameters]
IBM官方中文文檔:wsadmin命令行詳細用法
以下例子中調用API采用jython腳本格式腺劣,因為jython腳本比jacl腳本的可讀性更好。
install:
wsadmin -lang jython -c "AdminApp.install('e:/was_workspace/test/pbw-ear.ear','[-contextroot?hello -appname hello -usedefaultbindings]')" -conntype SOAP -host localhost -port 8880 ?-user admin -password admin
export:
wsadmin-lang jython -c "AdminApp.export('hello', 'e:/was_workspace/test/hello.ear')" -conntype SOAP -host localhost -port 8880? -user admin -password admin
stop:
wsadmin-lang jython -c "AdminControl.invoke(AdminControl.queryNames('type=ApplicationManager,node=coresvr1Node01,*'),'stopApplication','hello')" -conntype SOAP -host localhost -port 8880 ?-user admin -password admin
update:
wsadmin -lang jython -c "AdminApp.update('hello', 'app', '[-operation update -contents e:/was_workspace/test/pbw-ear.ear -usedefaultbindings -nodeployejb]')" -conntype SOAP -host localhost -port 8880 ?-user admin -password admin
start:
wsadmin-lang jython -c "AdminControl.invoke(AdminControl.queryNames('type=ApplicationManager,node=coresvr1Node01,*'),'startApplication','hello')" -conntype SOAP -host localhost -port 8880 ?-user admin -password admin
另因块,必須要查看IBM的手冊橘原,網上很多帖子太簡單,實際寫的時候沒法參考。
IBM官方中文文檔:對應用程序服務環(huán)境進行腳本編制 (wsadmin)