unter Linux/Unix ist es ja recht einfach mal eben ein paar Start und Stop Skripte zu bauen. Da kann man die Skripte von Oracle nutzen und diese dann in den Hintergrund stellen. Unter Windows ohne PowerShell ist dass nun nicht wirklich angenehm. Ich habe mir dazu mal ein paar Skripte aufgebaut.
als erstes wird mit dem Skript von Oracle C:\oracle\user_projects\domains\FRDomain\bin\installNodeMgrSvc.cmd ein Windows Service für den Nodemanger erstellt. Dann läuft der schon einmal wenn der Server neu gestartet wird.
Ich habe mir jetzt erst einmal zwei *.cmd Skripte gebaut.
Inhalt startAll.cmd
c: cd C:\oracle\user_projects\domains\FRDomain\bin C:\oracle\Middleware\oracle_common\common\bin\wlst.cmd startAll.py
das Python Skript dazu sieht wie folgt aus: Das selbe Skript nehme ich auch zum stoppen. So habe ich immer die Prozesse im Hintergrund und sie werden der Reihen nach gestartet.
Bei Stop bloss die Passagen umbauen.
Verfolgen tail -f unter Windows .-) : aus der Powershell heraus :Get-Content C:\oracle\user_projects\domains\FRDomain\nodemanager\nodemanager.log -Wait Dann kann ich sehr schön das ganze verfolgen.
def serverStatus(server): print "Server = "+server cd('/ServerLifeCycleRuntimes/'+server); return cmo.getState(); def ComponentStatus(server): print "Server = "+server cd('/SystemComponentLifeCycleRuntimes/'+server) return cmo.getState(); def startComponent(ComponentName): cd('/SystemComponentLifeCycleRuntimes/'+ComponentName) wert=cmo.start(None) def stopComponent(ComponentName): cd('/SystemComponentLifeCycleRuntimes/'+ComponentName) wert=cmo.shutdown(None) def startAdminserver(): print "===============================================" print "Admin Server wird gestartet" print "Connect gegen NodeManager" nmConnect(v_username, v_password, v_host, v_port, v_domain, v_domainVZ) nmStart('AdminServer') nmDisconnect(); def stopAdminserver(): print "===============================================" print "Admin Server wird gestoppt" print "Connect gegen NodeManager" try: nmConnect(v_username, v_password, v_host, v_port, v_domain, v_domainVZ) nmKill('AdminServer') nmDisconnect(); except: print "Konnte mich nicht gegen NM" def startAllWLS(): print "===============================================" connect(v_username,v_password,v_connect) srvs = cmo.getServers() domainRuntime() for server in srvs: if server.getName() != "AdminServer": ServerName=server.getName(); ##print "Server :"+ServerName serverState=serverStatus(ServerName) print ServerName +" ist im Status " + serverState if serverState !="RUNNING": start(ServerName,'Server'); def stopAllWLS(): print "===============================================" connect(v_username,v_password,v_connect) srvs = cmo.getServers() domainRuntime() for server in srvs: if server.getName() != "AdminServer": ServerName=server.getName(); ##print "Server :"+ServerName serverState=serverStatus(ServerName) print ServerName +" ist im Status " + serverState if serverState =="RUNNING": shutdown(ServerName,'Server','true',1000,block='true'); def startAllComponent(): print "===============================================" connect(v_username,v_password,v_connect) srvs = cmo.getSystemComponents() domainRuntime() for systemComponents in srvs: if systemComponents.getName() != "forms1": ServerName=systemComponents.getName(); serverState=ComponentStatus(ServerName) print "Status "+serverState if serverState !="RUNNING": print ServerName startComponent(ServerName); def stopAllComponent(): print "===============================================" connect(v_username,v_password,v_connect) srvs = cmo.getSystemComponents() domainRuntime() for systemComponents in srvs: if systemComponents.getName() != "forms1": ServerName=systemComponents.getName(); serverState=ComponentStatus(ServerName) print "Status "+serverState if serverState =="RUNNING": print "stopping "+ServerName stopComponent(ServerName); serverState=ComponentStatus(ServerName) print "Status "+serverState v_StartStop='Start';#os.environ('STARTSTOP'); v_username="weblogic" v_password="welcome1" v_host='localhost' v_port='5556' v_adminport='7101' v_domain='FRDomain' v_domainVZ='C:\oracle\user_projects\domains\FRDomain' v_connect="t3://"+v_host+":"+v_adminport; print "Check "; print v_username; print v_password; print "v_connect "+v_connect; startAdminserver() startAllWLS() startAllComponent() #print "alles wieder stoppen" #stopAllComponent() #stopAllWLS() #disconnect() #stopAdminserver()
Eintragen als Windows Start/Stop
Script eintragen
Die Kommentarfunktion ist geschlossen.