Author |
|
ashwani_ap
Joined: 29 Aug 2007 Posts: 47 Location: Bangalore
|
Posted: Thu 30 Aug '07 12:09 Post subject: Is there any way to make the two httpd.exe dependable. |
|
|
Hi,
Is there any way to make the two httpd.exe dependable on each other. So that when I kill one main PID oh httpd.exe, other should get killed.
-Ashwani- |
|
Back to top |
|
poetics5
Joined: 31 Aug 2007 Posts: 6 Location: all over
|
Posted: Fri 31 Aug '07 4:34 Post subject: |
|
|
just wondering how are you running both at the same time?
also you could make a .bat file to call a stop on both files, my $.02 |
|
Back to top |
|
ashwani_ap
Joined: 29 Aug 2007 Posts: 47 Location: Bangalore
|
Posted: Fri 31 Aug '07 12:12 Post subject: writing .bat file for killing the two httpd.exe |
|
|
Hi,
Please guide how to write the .bat file for killing both the .exe of apache. I am not able to kill only the parent process, because I know only the PID of that. Urgent please |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Fri 31 Aug '07 12:29 Post subject: |
|
|
Code: |
@echo off
TASKKILL /F /IM httpd.exe
|
Tested under XP and 2003.
When you run it as a service
httpd -k stop |
|
Back to top |
|
ashwani_ap
Joined: 29 Aug 2007 Posts: 47 Location: Bangalore
|
Posted: Fri 31 Aug '07 13:06 Post subject: Generic kill method for all the windows platform |
|
|
Actually, I tried this command but it works only for few win platforms.
I want to use some generic comand for all the win platform. Or please tell me some C Windows code to do so.
Actually in my C code I am able to start the Apache web server by calling spawn(). This returns the PID for the parent process httpd.exe. Using this PID I am able to kill that I am not able to kill both the httpd.exe because I am not able to find the PID for both. I did this.
hProcess1 = OpenProcess(PROCESS_TERMINATE, FALSE, pi.dwProcessId);
if (hProcess1 == NULL) return FALSE;
dwError = ERROR_SUCCESS;
if (!TerminateProcess(hProcess1, (DWORD)-1))
dwError = GetLastError();
But in vain. Please guide me. this also kills the parent process and lives the child httpd.exe running which in turn relies to all the web request. |
|
Back to top |
|
poetics5
Joined: 31 Aug 2007 Posts: 6 Location: all over
|
Posted: Fri 31 Aug '07 20:26 Post subject: |
|
|
actually i was thinking you could just do something like
path to http1 httpd -k stop
path to http2 httpd -k stop |
|
Back to top |
|