Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run script or program upon successful launch of Apache

Status
Not open for further replies.

KevinAr18

Programmer
Apr 25, 2002
309
US
Is there a way to launch a program or a script once Apache has successfully launched. Like add it to the end of the startup proceedure or something.
 
It would be groovy to know the OS you are running don't ya think? :) The answer to your question is yes, there is a way, but we need to know the OS to be able to tell you what you need to do.
 
There are a few ways you can do it. Without knowing what you want to do or run after apache is loaded, I would say you could create a batch file that will load apache then your program or script. If you need it to run if and only if apache is running, you can have it look for the pid file or have it execute based on the error level returned by apache when it loads. Will you be running apache as a service or in a window? Do you want apache to load whenever windows is running? If you need more specific help, let us know exactly what you want to do.
 
I have a package called indigoperl, which contains Apache, Perl, and other things all rolled into one.
It launches Apache using the folowing shortcut:
C:\Sierra\op2map\bin\Apache.exe -f "C:/Sierra/op2map/conf/httpd.conf"

Once launched a dos window shows up indicating Apache is running.
Once Apache is running I would like it to open a certain html page on my harddrive. I figured if I could run a script I could just as easily make that script open a html page on my harddrive.

At batch file will NOT work, cause one thing has to finish or be closed before the other one will happen.

For example, if I tell it to open the html page and then apache, apache will not start till I close the html window.


P.S. Can you give any explanation step by step as I do not know the name of certain files or where there are at in the Apache server. So when you mention the pid file I have no idea what it is or how to edit it.
 
You lost me real good this time. :eek:) What do you mean, you want apache to open an html page? That isn't how a web server works. If you put your web pages in the directory that is defined as DocumentRoot in httpd.conf, apache will serve the page named "index.html" by default when you type in your browser. If you are only using this server locally, then you should be able to type localhost in the browser and that same page will be served. A web server's only job is to listen on port 80 for http requests and serve the page requested using the directives in the configuration file (httpd.conf in this case).
 
Well, I don't want the user to even know they are using a server. All this is for use on a persons computer and not the internet. I have a package that installs the server and all files with it.

Thus, I want Apache to start-up and then the browser to automatically open to a page I specify on the users harddrive. The page that opens up will on occassion use the server part of things to do some stuff a normal static html page could not do. Once again it's all on the users computer (localhost).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top