Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Apache restart failed
PostPosted: Sun Aug 08, 2010 7:07 pm 
Offline
Senior Newbie

Joined: Thu May 27, 2010 9:00 am
Posts: 14
Hi,

I did absolutely nothing in the last 24 hours to the server only for me to visit my websites today and got the "problem loading page" error.

The problem is my apache web server stopped working. Linode support verified this diagnosis.

What I need now is help getting it restarted. I have tried :
sudo apache2ctl restart but that only came back with the following message
Code:
httpd not running, trying to start

My linode is running on Ubuntu.

Can someone tell me what could have gone wrong and how I can fix this problem, please ?


Top
   
 Post subject:
PostPosted: Sun Aug 08, 2010 7:16 pm 
Offline
Senior Newbie

Joined: Tue Mar 30, 2010 11:18 pm
Posts: 10
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start

Alternatively, 'ps aux | grep apache2'

Then sudo kill -9 the process ids like 'sudo kill -9 1213' or whatever the PID is.

Then try starting apache.

_________________
My blog :3 http://infocalypse-net.info/infocalypse


Top
   
 Post subject:
PostPosted: Sun Aug 08, 2010 7:36 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
Also check your apache error log (probably in /var/log) for any errors.


Top
   
 Post subject: Thanks, but .....
PostPosted: Mon Aug 09, 2010 4:45 am 
Offline
Senior Newbie

Joined: Thu May 27, 2010 9:00 am
Posts: 14
Nisstyre56 wrote:
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start

Alternatively, 'ps aux | grep apache2'

Then sudo kill -9 the process ids like 'sudo kill -9 1213' or whatever the PID is.

Then try starting apache.


Thanks for you input.

I tried both strategies last night but I just did so again.
starting with the kill command, I did ps aux | grep apache2 as you suggested.
I only got one line of output. I presume the process id is the first set of number from the left after the user id ?!?

I then tried the kill command with the process id but it came back with the following error:
Code:
-bash: kill: (3330) - No such process


Also, when I tried the same thing last night the process id was different. I don't know if that is normal ??


sudo /etc/init.d/apache2 stop - worked fine. The output was
Code:
Stopping web server apache2 [ OK ]


However, sudo /etc/init.d/apache2 start reported
Code:
Starting web server apache2 [fail]


Top
   
 Post subject: Thanks .... got it
PostPosted: Mon Aug 09, 2010 4:55 am 
Offline
Senior Newbie

Joined: Thu May 27, 2010 9:00 am
Posts: 14
obs wrote:
Also check your apache error log (probably in /var/log) for any errors.


I appreciate your input.

The error logs show that my website was missing a log directory and an error.log file.

I remember a friend telling me that apache would fail under such circumstances. I have drupal websites and I recently upgraded drupal core so I guess I wiped out and forgot to replace the log directory.

Once I recreated it, apache was happy to restart.

Thanks a great deal.


Top
   
 Post subject: Re: Thanks, but .....
PostPosted: Mon Aug 09, 2010 6:49 am 
Offline
Newbie

Joined: Mon Aug 09, 2010 6:32 am
Posts: 2
sisko wrote:
I tried both strategies last night but I just did so again.
starting with the kill command, I did ps aux | grep apache2 as you suggested.
I only got one line of output. I presume the process id is the first set of number from the left after the user id ?!?

I then tried the kill command with the process id but it came back with the following error:
Code:
-bash: kill: (3330) - No such process


Also, when I tried the same thing last night the process id was different. I don't know if that is normal ??


For future reference, when you do
Code:
ps aux | grep <something>
you should get two (or more) lines back if that thing you were looking for is running. One of them is the grep command itself that contains the searched string as a parameter, hence finding itself in the list of process. That's why kill doesn't find it later, it was there when the ps aux run, you got it's PID, but it's long gone when you try to kill it. Running the same command again will give grep a new PID.
So you are interested in the other[s] line[s] of output, the ones that (don|doesn)'t contain grep in (it|them).
<self_critique>Unless of course you were looking for a run amok grep per se, one that is upping your linode I/O rate to the clouds and completely flats at 100% one CPU core, for someone put too little specificity in the path that it was recurring on. </self_critique> :roll:


Top
   
 Post subject: Re: Thanks, but .....
PostPosted: Mon Aug 09, 2010 9:58 am 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
geppa wrote:
For future reference, when you do
Code:
ps aux | grep <something>
you should get two (or more) lines back if that thing you were looking for is running.


There's a simple solution to this. Grep uses regular expressions. So, instead of:

ps aux | grep foo

Do this:

ps aux | grep [f]oo

No longer will you see two lines, because "grep [f]oo" won't match itself.


Top
   
 Post subject: Re: Thanks, but .....
PostPosted: Mon Aug 09, 2010 10:02 am 
Offline
Senior Member
User avatar

Joined: Tue Nov 24, 2009 1:59 pm
Posts: 362
Guspaz wrote:
There's a simple solution to this. Grep uses regular expressions. So, instead of:

ps aux | grep foo

Do this:

ps aux | grep [f]oo

No longer will you see two lines, because "grep [f]oo" won't match itself.


*cough*sh-ism*cough*
Quote:
% ps aux | grep [f]oo
zsh: no matches found: [f]oo


ps aux | grep '[f]oo'

is the safe, portable option ;)


Top
   
 Post subject: Re: Thanks, but .....
PostPosted: Mon Aug 09, 2010 12:37 pm 
Offline
Senior Member

Joined: Fri Jan 09, 2009 5:32 pm
Posts: 634
sisko wrote:
However, sudo /etc/init.d/apache2 start reported
Code:
Starting web server apache2 [fail]


check your apache logs, you likely have a configuration error.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group