You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Martin Atkins <ma...@degeneration.co.uk> on 2005/10/06 11:29:13 UTC
[users@httpd] Controlling Apache Win32 as a Console App
Hi folks,
I'm currently putting together a small bundle of software which others
here at my company can use to give a demo of a webapp product. A goal is
that the user should just be able to (for example) copy the directory to
a laptop computer, run it at a customer site and then delete it
afterwards with no installation of any sort.
As part of this, I have mySQL and Apache running as console applications
rather than services. Some of the users giving demos don't have
administrative permissions, so service installation is not possible. I
provide a couple of simple scripts to start and stop the servers. mySQL
is working like a charm, however...
It doesn't seem to be possible to use "apache -k shutdown" to kill an
Apache instance running as a console app. It simply moans about not
being able to find the Apache2 service:
[Thu Oct 06 10:28:27 2005] [error] (OS 2)The system cannot find the file
specified. : No installed service named "Apache2".
Closing the console window terminates Apache, but if possible I'd like
to be able to wrap all of the shutdown (which includes some cleanup for
our own app) into one script.
I'm currently using Apache 2.0.54. I vauguely remember being able to do
this with Apache 1.3 back in the day, but I might well be remembering
running it on Win9x rather than NT.
Ideally I'd also like to make the console app go into the background
like mySQL's does, but that's not critical.
Any ideas?
Thanks,
Martin Atkins
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
[users@httpd] Re: Controlling Apache Win32 as a Console App
Posted by Martin Atkins <ma...@degeneration.co.uk>.
Joost de Heer wrote:
>>If you want to script this, get something like ptree (from the resource
>>kit) or pskill (from sysinternals) to kill the process.
>
>
> I just remembered that ptree requires a service to be installed, so drop
> that option. pskill is what you want.
>
Thanks for the advice. That seems to work just fine.
I also wrote a small, quick and dirty Win32 console app which waits for
the console to be closed and then runs a second process, allowing both
mySQL and Apache to run in the same console and both be shut down
properly when the window is closed. I've attached the source code in
case anyone else tries to do the same kind of thing as I have tried. In
my setup, runonclose is called with a cmd script as its parameter.
All the best,
-Martin
[users@httpd] Re: Controlling Apache Win32 as a Console App
Posted by Joost de Heer <sa...@xs4all.nl>.
> If you want to script this, get something like ptree (from the resource
> kit) or pskill (from sysinternals) to kill the process.
I just remembered that ptree requires a service to be installed, so drop
that option. pskill is what you want.
Joost
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
[users@httpd] Re: Controlling Apache Win32 as a Console App
Posted by Joost de Heer <sa...@xs4all.nl>.
> It doesn't seem to be possible to use "apache -k shutdown" to kill an
> Apache instance running as a console app. It simply moans about not
> being able to find the Apache2 service:
> [Thu Oct 06 10:28:27 2005] [error] (OS 2)The system cannot find the file
> specified. : No installed service named "Apache2".
That's because '-k shutdown' is basically a wrapper around 'net stop'. (I
know, not exactly true, but for explanation purposes it is ;)
If you want to script this, get something like ptree (from the resource
kit) or pskill (from sysinternals) to kill the process.
Joost
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org