[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Is there a way to restart Apache after boot?

Posted on 2008-11-13
6
Medium Priority
?
253 Views
Last Modified: 2012-06-27
On this XP PRO PC, IIS is using port 80, and Apache 2.2 is using port 8080.  When the computer is started, Apache dies because the port isn't available at that time.  A restart works okay.  I guess this is due to IIS being started at the same time.

So is there a way to schedule Apache to be restarted a minute after boot, or whenever it fails?  Or delay it's automatic start?  
0
Comment
Question by:wilri01
  • 4
  • 2
6 Comments
 
LVL 15

Expert Comment

by:ncoo
ID: 22952236
Have you installed apache as a service?

if not goto Run and type CMD.

Navigate to your apache/bin forlder in CMD

Type: httpd -k install -n "Apache2"

Under control panel goto Admin Tools -> Services

Find Apache2 double click it and choose startup Type: Auto

Apply and Ok.

Any restart of windows will start apache.
0
 
LVL 15

Expert Comment

by:ncoo
ID: 22952246
If apache is already a service.

Under control panel goto Admin Tools -> Services

Find Apache2 double click it and choose startup Type: Auto

Apply and Ok.

Any restart of windows will start apache.
0
 

Author Comment

by:wilri01
ID: 22954652
Apache starts, but has an error.  What I need, asuming I can't fix the error, is to do a restart a little later.  The error is something like the port 8080 isn't available to listen on.  Evidently, Apache is trying to start before networking gets up fully.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 15

Expert Comment

by:ncoo
ID: 22959073
I've never known apache have to wait for networking, I am running it under XP and Server 2003 with out any issue like this.

Can you open your httpd.conf file and confirm it says:

Listen 8080

Have you got multiple instances of Apache running? Open Apache Monitor to check.

Can you paste the details from the apche error log, look for "ErrorLog" driver/folder/file in your conf file if you're not sure where it is located

Do you have any other applications installed running on 8080?

0
 

Author Comment

by:wilri01
ID: 22960126
The listen is on ipAddress:8080.  This is the only application using the port. Like I said, it works later on a restart of Apache.  And the error is that this port is not available.  The computer is on a large LAN, so I'm guessing network connections are simply not established yet.  The error log previously showed that even the domain controller could not be found and Group Policy could not be applied.  Yesterday we had a 1 second power hit and when the machine restarted, it worked okay.  The problem is when a Windows update is pushed that requires rebooting, or a more serious power outage.

This is the first time I've experienced this myself, but it's also the only machine where IIS is also running (on port 80).

So you don't know of a way to use Windows Task Scheduler to do an Apache restart shortly after a computer boot?  Maybe a script that does a wait for 30 seconds and then issues the restart?
0
 
LVL 15

Accepted Solution

by:
ncoo earned 2000 total points
ID: 22962156
In your conf you have?

Listen 1.2.3.4:8080

Change that just to

Listen 8080

It's what I use on server 2003 with out any problems, even with windows updates causing restarts.

A script could be written to run in the background that starts apache when it's not running.

A VB script should be able to do it.

Try the conf change first. Do you have anything else in your conf file, virtual hosts?
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month20 days, 9 hours left to enroll

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question