Author | Topic: WTRLaunch | |
---|---|---|
Pawel Lancucki | WTRLaunch on Thu, 06 Jan 2005 00:08:26 +0100 Hi. Phil , how can I use WTRLaunch.exe outside from the server ? How use it inside my dll ? eg. RUNSHELL(" /C START C:\ALASKA\WAA1W32\SERVWER\WTRLAUNCH.EXE",,.T. ) Best regards Pawe acucki pawel.lancucki@lanco.pl www.lanco.pl GG 707752 | |
Phil Ide | Re: WTRLaunch on Thu, 06 Jan 2005 09:33:18 +0000 Pawel, > Phil , how can I use WTRLaunch.exe outside from the server ? If you mean from another machine, then you can't. It can kill the process remotely, but cannot restart it. > How use it inside my dll ? > eg. RUNSHELL(" /C START C:\ALASKA\WAA1W32\SERVWER\WTRLAUNCH.EXE",,.T. ) Yep, that should do it Regards, Phil Ide *************************************** * Xbase++ FAQ, Libraries and Sources: * * goto: http://www.idep.org.uk/xbase * *************************************** Keep yr eye upon the doughnut,¬ upon the hole | |
Pawel Lancucki | Re: WTRLaunch on Thu, 06 Jan 2005 13:35:57 +0100 Yes, I know that WTRLaunch.exe run on sever, but how start it form outside. look at my prg. in MYDLL.dll ... function killme() RUNSHELL(" /C START C:\ALASKA\WAA1W32\SERVER\WTRLAUNCH.EXE", ,.T., .F. ) quit return .t. .... from outside http://...../waa1gate.exe?WAA_PACKAGE=MYDLL&WAA_FORM=KILLME after that WAA is closed but not correct. WTRLAUNCH.EXE run but can't restart WAA , beacouse one proces waa1gate.exe is open in memory on server. Why after quit WAA not close correct. Paul Uzytkownik "Phil Ide" <phil@idep.org.uk> napisal w wiadomosci news:1scdmboulirtd$.dlg@idep.org.uk... > Pawel, > > > Phil , how can I use WTRLaunch.exe outside from the server ? > > If you mean from another machine, then you can't. It can kill the process > remotely, but cannot restart it. > > > How use it inside my dll ? > > eg. RUNSHELL(" /C START C:\ALASKA\WAA1W32\SERVWER\WTRLAUNCH.EXE",,.T. ) > > Yep, that should do it > > Regards, > -- > Phil Ide > > *************************************** > * Xbase++ FAQ, Libraries and Sources: * > * goto: http://www.idep.org.uk/xbase * > *************************************** > > Keep yr eye upon the doughnut,¬ upon the hole | |
Phil Ide | Re: WTRLaunch on Thu, 06 Jan 2005 13:14:08 +0000 Pawel, > Yes, I know that WTRLaunch.exe run on sever, but how start it form > outside. > look at my prg. > in MYDLL.dll > ... > function killme() > RUNSHELL(" /C START C:\ALASKA\WAA1W32\SERVER\WTRLAUNCH.EXE", ,.T., .F. ) > quit > return .t. > .... > from outside > > http://...../waa1gate.exe?WAA_PACKAGE=MYDLL&WAA_FORM=KILLME That will launch WTRLaunch on your machine, not on the server, therefore it cannot restart WAA. > after that WAA is closed but not correct. > WTRLAUNCH.EXE run but can't restart WAA , beacouse one proces > waa1gate.exe is open in memory on server. > Why after quit WAA not close correct. I'm not sure - I've never come oacross this problem. WAA always shuts down correctly for me, even if I issue the KILLME call from my web-browser (BTW, I use a very different function name that won't be discovered by accident by a malicious user - e.g. WAA_FORM=KickMyButtAndMakeMeScreamQuietlyPlease) Regards, Phil Ide *************************************** * Xbase++ FAQ, Libraries and Sources: * * goto: http://www.idep.org.uk/xbase * *************************************** Blood is thicker than water, and much tastier | |
Pawel Lancucki | Re: WTRLaunch on Thu, 06 Jan 2005 14:24:47 +0100 Uzytkownik "Phil Ide" <phil@idep.org.uk> napisal w wiadomosci news:1dehhgo6n7sue.dlg@idep.org.uk... > Pawel, > > > Yes, I know that WTRLaunch.exe run on sever, but how start it form > > outside. > > look at my prg. > > in MYDLL.dll > > ... > > function killme() > > RUNSHELL(" /C START C:\ALASKA\WAA1W32\SERVER\WTRLAUNCH.EXE", ,.T., .F. ) > > quit > > return .t. > > .... > > from outside > > > > http://...../waa1gate.exe?WAA_PACKAGE=MYDLL&WAA_FORM=KILLME > > That will launch WTRLaunch on your machine, not on the server, therefore > it cannot restart WAA. Why ? All function in dll works on the server and after send html to client > I use a very different function name that won't be discovered by accident > by a malicious user > KickMyButtAndMakeMeScreamQuietlyPlease nice name Yes, I agree with you, I will change the name of function killme Paul | |
Phil Ide | Re: WTRLaunch on Thu, 06 Jan 2005 15:16:02 +0000 Pawel, >>> http://...../waa1gate.exe?WAA_PACKAGE=MYDLL&WAA_FORM=KILLME >> >> That will launch WTRLaunch on your machine, not on the server, therefore >> it cannot restart WAA. > > Why ? > All function in dll works on the server and after send html to client Aaah, KillMe is a function in MyDll.dll? In that case: You issue the request, which arrives at the server via waa1gate.exe. The function calls QUIT, which is an imperative command and does not allow the application to gracefully exit. This means that threads are terminated immediately, therefore open sockets are abandoned. Since it was not a graceful shutdown, waa1gate.exe doesn't know the other end of it's socket connection to waa1srv.exe is no longer valid. This leaves waa1gate.exe running indefinitely unless the web server imposes a timeout on it. The solution to this is to make the shutdown more sophisticated so that performs a graceful shutdown. Put this lot in your code, and call the KillMe function from your browser (as before, I'd suggest renaming this function to something less easy to discover by accident). The way it works is by 'clicking' the close button on the WAA console dialog, then 'clicking' the 'Ok' button on the WAA Shutdown dialog. Function KillMe( oHtml, oContext ) local oThread := Thread():new() oHtml:put(GeneratePage()) oThread:start({||____DeathByAnyOtherName()}) return TRUE STATIC Function ____DeathByAnyOtherName() local oWin := GetRootWin() PostAppEvent( xbeP_Close, NIL, NIL, oWin ) sleep(10) increase this if necessary (this should be enough) oWin := SetAppFocus() oWin:activate() return TRUE STATIC Function GetRootWin() local oDlg := SetAppFocus() While !(oDlg:setParent() == AppDeskTop()) oDlg := oDlg:setParent() Enddo return oDlg STATIC Function GeneratePage() local cText TEXT INTO cText TRIMMED <html> <head> <title>WAA Shutdown</title> </head> <body> <table style="background-color:#a0a0a0; border:outset 2px" cellpadding="5"><tr><td> <span style="color:#8b0000; font-size=2em"> <b>WAA1SRV says "Bye-bye!"</b> </span><br> <span style="color:#ffffff; font-size=0.8em"> This code courtesy of the Xbase++ newsgroups </span> </td></tr></table> </body> </html> ENDTEXT return cText Regards, Phil Ide *************************************** * Xbase++ FAQ, Libraries and Sources: * * goto: http://www.idep.org.uk/xbase * *************************************** Dedicated to the brave men who go down to the chips in C. | |
Phil Ide | Re: WTRLaunch on Thu, 06 Jan 2005 15:32:16 +0000 Pawel, Of course, you need to call the function you called before, which will launch WTRLaunch, which in turn will call the function I just gave you to kill the application. Regards, Phil Ide *************************************** * Xbase++ FAQ, Libraries and Sources: * * goto: http://www.idep.org.uk/xbase * *************************************** Lawyers: the larval form of politicians. | |
Pawel Lancucki | Re: WTRLaunch on Thu, 06 Jan 2005 19:48:26 +0100 Thanks for all, it's nice solution. . > Of course, you need to call the function you called before, which will > launch WTRLaunch, which in turn will call the function I just gave you to > kill the application. I have one more question, if I understand I have to call WTRLaunch.exe in my first function KillMe_first() which call my second function KillMe_second() in MYDLL.dll ................................. function KillMe_first() RUNSHELL(" /C START C:\ALASKA\WAA1W32\SERVER\WTRLAUNCH.EXE", ,.T., .F. ) return .t. ................................. Function KillMe_second( oHtml, oContext ) local oThread := Thread():new() oHtml:put(GeneratePage()) oThread:start({||____DeathByAnyOtherName()}) return TRUE STATIC Function ____DeathByAnyOtherName() local oWin := GetRootWin() PostAppEvent( xbeP_Close, NIL, NIL, oWin ) sleep(10) increase this if necessary (this should be enough) oWin := SetAppFocus() oWin:activate() return TRUE STATIC Function GetRootWin() local oDlg := SetAppFocus() While !(oDlg:setParent() == AppDeskTop()) oDlg := oDlg:setParent() Enddo return oDlg STATIC Function GeneratePage() local cText TEXT INTO cText TRIMMED <html> <head> <title>WAA Shutdown</title> </head> <body> <table style="background-color:#a0a0a0; border:outset 2px" cellpadding="5"><tr><td> <span style="color:#8b0000; font-size=2em"> <b>WAA1SRV says "Bye-bye!"</b> </span><br> <span style="color:#ffffff; font-size=0.8em"> This code courtesy of the Xbase++ newsgroups </span> </td></tr></table> </body> </html> ENDTEXT return cText ------------------------------------- From other machine http://...../waa1gate.exe?WAA_PACKAGE=MYDLL&WAA_FORM=KillMe_first ------------------------------------- in WTRLaunch.ini [PATHS] weburl=http://localhost appname=startwaa.bat command=WAA_PACKAGE=MYDLL&WAA_FORM=KillMe_Second -------------------------------------- I'm waiting for your opinion Best regards Paul Lancucki | |
Phil Ide | Re: WTRLaunch on Fri, 07 Jan 2005 09:22:08 +0000 Pawel, > Thanks for all, it's nice solution. . > Yes, it does work rather well doesn't it? > I have one more question, if I understand I have to call WTRLaunch.exe > in my first function KillMe_first() > which call my second function KillMe_second() Yes, that's the way to do it. Regards, Phil Ide *************************************** * Xbase++ FAQ, Libraries and Sources: * * goto: http://www.idep.org.uk/xbase * *************************************** Jesus Saves, Moses invests, Cthulu forecloses. | |
Pawel Lancucki | Re: WTRLaunch on Fri, 07 Jan 2005 22:44:26 +0100 Hi Phil Sorry, but it doesn't work. It's good for shutdown WAA from outside and if WAA will be start manualy on server its work, but I have to restart WAA from outside. it is from my code: FUNCTION KillMe_first( oHtml, oContext ) RUNSHELL(" /C D:\ALASKA\WAA1W32\SERVER\WTRLAUNCH.EXE ",,.T.,.T. ) oHtml:message('Information from Server' , 'WTRLaunch.exe run on Server') RETURN .T. FUNCTION KillMe_second( oHtml, oContext ) LOCAL oThread := Thread():new() oHtml:put(GeneratePage()) oThread:start({||____DeathByAnyOtherName()}) RETURN .T. STATIC FUNCTION ____DeathByAnyOtherName() . here is your code ( clear ) . --------------------- WTRLauch.ini [PATHS] weburl=http://10.0.0.22 appname=startwaa.bat command=WAA_PACKAGE=MYDLL&WAA_FORM=KillMe_second ---------------- http://10.0.0.22/cgi-bin/waa1gate.exe?WAA_PACKAGE=MYDLL&WAA_FORM=KillMe_first WAA10501.LOG >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>> [2005-01-07 22:00:17] SERVER STARTUP >>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> [2005-01-07 22:00:17] *** Package:MYDLL successfully loaded [2005-01-07 22:00:17] *** worker #2 ready for service [2005-01-07 22:00:17] *** worker #3 ready for service [2005-01-07 22:00:17] *** worker #4 ready for service [2005-01-07 22:00:17] *** worker #5 ready for service [2005-01-07 22:00:17] *** worker #6 ready for service [2005-01-07 22:00:17] *** requester up and running [2005-01-07 22:00:32][#2:Pkg][//MYDLL/KILLME_FIRST] request at [10.0.0.22] [2005-01-07 22:00:32][#2:End][//MYDLL/KILLME_FIRST] elapsed time [0.07] [2005-01-07 22:00:34][#3:Pkg][//MYDLL/KILLME_SECOND] request at [10.0.0.22] [2005-01-07 22:00:34][#3:End][//MYDLL/KILLME_SECOND] elapsed time [0.01] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>> [2005-01-07 22:00:49] SERVER STARTUP >>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> [2005-01-07 22:00:49] *** Package:MYDLL successfully loaded [2005-01-07 22:00:49] *** worker #2 ready for service [2005-01-07 22:00:49] *** worker #3 ready for service [2005-01-07 22:00:49] *** worker #4 ready for service [2005-01-07 22:00:49] *** worker #5 ready for service [2005-01-07 22:00:50] *** worker #6 ready for service [2005-01-07 22:00:50] ERR: gateway could not be reached [2005-01-07 22:00:50] *** worker #7 Cannot connect to socket [2005-01-07 22:00:50] ERR: requester failed to connect What is wrong ? Paul | |
Phil Ide | Re: WTRLaunch on Mon, 10 Jan 2005 09:55:34 +0000 Pawel, > [2005-01-07 22:00:32][#2:Pkg][//MYDLL/KILLME_FIRST] request at [10.0.0.22] > [2005-01-07 22:00:32][#2:End][//MYDLL/KILLME_FIRST] elapsed time [0.07] > [2005-01-07 22:00:34][#3:Pkg][//MYDLL/KILLME_SECOND] request at [10.0.0.22] > [2005-01-07 22:00:34][#3:End][//MYDLL/KILLME_SECOND] elapsed time [0.01] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>> [2005-01-07 22:00:49] SERVER STARTUP >>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > [2005-01-07 22:00:49] *** Package:MYDLL successfully loaded > [2005-01-07 22:00:49] *** worker #2 ready for service > [2005-01-07 22:00:49] *** worker #3 ready for service > [2005-01-07 22:00:49] *** worker #4 ready for service > [2005-01-07 22:00:49] *** worker #5 ready for service > [2005-01-07 22:00:50] *** worker #6 ready for service > [2005-01-07 22:00:50] ERR: gateway could not be reached > [2005-01-07 22:00:50] *** worker #7 Cannot connect to socket > [2005-01-07 22:00:50] ERR: requester failed to connect > > What is wrong ? Well, everything looks Ok during the shutdown phase. KILLME_FIRST has launched WTRLaunch, which then calls KILLME_SECOND. Both functions seem to end properly. WTRLaunch obviously launches WAA again, but for some reason the gateway seems to be blocked. As for the error "gateway could not be reached", I'm not sure where that comes from, because WAA does not know where the gateway is. All it can do is open a listening socket on the port named in the environment (via the SET WAA_PORT= line in startwaa.bat). As a first step to solving this error, what happens if you launch WTRLaunch from the command line while WAA is running? Regards, Phil Ide *************************************** * Xbase++ FAQ, Libraries and Sources: * * goto: http://www.idep.org.uk/xbase * *************************************** This Tag line is self referencing! |