How to restart Apache

This is a discussion on How to restart Apache within the Apache forums in Application Servers & Tools category; Is there a way how to restart Apache if pid file is missing? I use my own demon.It happened that the demon deleted /var/run/apache2.pid file. Then I can not use /etc/init.d/apache2 restart but I must restart my Debian server by init 6 . After that the Apache starts normally. So, if the init 6 can solve the problem , is there a way how to restart Apache without restarting the server( Debian box) Thank you for help L.a. --------------------------------------------------------------------- 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 " ...

Go Back   Application Development Forum > Application Servers & Tools > Apache

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-27-2008, 07:41 AM
export@hope.cz
Guest
 
Default How to restart Apache

Is there a way how to restart Apache if pid file is missing?
I use my own demon.It happened that the demon deleted /var/run/apache2.pid file.
Then I can not use /etc/init.d/apache2 restart

but I must restart my Debian server by init 6 .
After that the Apache starts normally.

So, if the init 6 can solve the problem ,
is there a way how to restart Apache without restarting the server( Debian box)
Thank you for help
L.a.

---------------------------------------------------------------------
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


Reply With Quote
  #2  
Old 08-27-2008, 09:13 AM
Bradley Giesbrecht
Guest
 
Default Re: How to restart Apache

Others will answer this better I'm sure and I haven't used Debian in a
while but I would do:

$sudo ps ax | grep httpd

$sudo kill "lowest httpd process id goes here"

$sudo /etc/init.d/apache2 start


Or, since it looks like /var/run/httpd.pid contains only the pid of
the first (lowest numbered process) httpd process you may have luck
just creating the httpd.pid file with the lowest numbered process id
form the ps command with proper owner/group/permissions and use your
scripts to restart apache2.

$sudo echo "lowest httpd process id goes here" > /var/run/httpd.pid

$sudo /etc/init.d/apache2 restart


This seemed like a simple enough question for someone like me to offer
a little help.
That said I'd be more concerned about why files are missing.


//Brad


On Aug 27, 2008, at 4:41 AM, export@hope.cz wrote:

> Is there a way how to restart Apache if pid file is missing?
> I use my own demon.It happened that the demon deleted /var/run/
> apache2.pid file.
> Then I can not use /etc/init.d/apache2 restart
>
> but I must restart my Debian server by init 6 .
> After that the Apache starts normally.
>
> So, if the init 6 can solve the problem ,
> is there a way how to restart Apache without restarting the
> server( Debian box)
> Thank you for help
> L.a.
>
> ---------------------------------------------------------------------
> 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
>



---------------------------------------------------------------------
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


Reply With Quote
  #3  
Old 08-27-2008, 09:35 AM
Eric Covener
Guest
 
Default Re: How to restart Apache

On Wed, Aug 27, 2008 at 7:41 AM, <export@hope.cz> wrote:
> Is there a way how to restart Apache if pid file is missing?
> I use my own demon.It happened that the demon deleted /var/run/apache2.pid file.
> Then I can not use /etc/init.d/apache2 restart
>
> but I must restart my Debian server by init 6 .
> After that the Apache starts normally.
>
> So, if the init 6 can solve the problem ,
> is there a way how to restart Apache without restarting the server( Debian box)
> Thank you for help


Find the root-owned apache process with ps and send the signal you want:

http://httpd.apache.org/docs/2.2/stopping.html

--
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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


Reply With Quote
  #4  
Old 08-27-2008, 10:09 AM
Sander Temme
Guest
 
Default Re: How to restart Apache


On Aug 27, 2008, at 6:13 AM, Bradley Giesbrecht wrote:

> Others will answer this better I'm sure and I haven't used Debian in
> a while but I would do:


Debian names its httpd 'apache2'.

sctemme@surtur:~$ cat /var/run/apache2.pid
5692
sctemme@surtur:~$ sudo rm /var/run/apache2.pid
[sudo] password for sctemme:
sctemme@surtur:~$ cat /var/run/apache2.pid
cat: /var/run/apache2.pid: No such file or directory

> $sudo ps ax | grep httpd


sctemme@surtur:~$ ps -lC apache2
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
5 S 0 5692 1 0 78 0 - 43517 - ? 00:00:00
apache2
5 S 33 7436 5692 0 77 0 - 43517 - ? 00:00:00
apache2
5 S 33 7437 5692 0 77 0 - 43517 - ? 00:00:00
apache2
5 S 33 7438 5692 0 77 0 - 43517 - ? 00:00:00
apache2
5 S 33 7439 5692 0 81 0 - 43517 - ? 00:00:00
apache2
5 S 33 7440 5692 0 81 0 - 43517 - ? 00:00:00
apache2

(don't have to be root to do this)

> $sudo kill "lowest httpd process id goes here"


The one you want to touch is the one with PPID 1: that's the parent
process.

sctemme@surtur:~$ sudo kill -HUP 5692

> $sudo /etc/init.d/apache2 start


sctemme@surtur:~$ cat /var/run/apache2.pid
5692

In other words: a restart as effected by the Hangup signal puts the
pidfile back.

I would be worried about its disapearance in the first place though.

--
Sander Temme
sctemme@apache.org
PGP FP: 51B4 8727 466A 0BC3 69F4 B7B8 B2BE BC40 1529 24AF




Reply With Quote
  #5  
Old 08-27-2008, 02:36 PM
Joseph S D Yao
Guest
 
Default Re: How to restart Apache

On Wed, Aug 27, 2008 at 01:41:48PM +0200, export@hope.cz wrote:
> Is there a way how to restart Apache if pid file is missing?
> I use my own demon.It happened that the demon deleted /var/run/apache2.pid file.
> Then I can not use /etc/init.d/apache2 restart
>
> but I must restart my Debian server by init 6 .
> After that the Apache starts normally.
>
> So, if the init 6 can solve the problem ,
> is there a way how to restart Apache without restarting the server( Debian box)
> Thank you for help
> L.a.



Check whether the 'killall' or 'skill' commands have been installed on
your system. Check the manual pages. You should be aboe to do one of
these [assuming that the information about 'httpd' renamed to 'apache2'
is correct]:
killall -HUP apache2
skill -HUP -c apache2
and then:
cd /
/etc/init.d/apache2 start


It looks like 'killall' is in the "psmisc" package, if you don't have it
installed.

http://www.ducea.com/2008/08/18/killall-in-debian/


I will add my voice to the rising choir saying, find out why the thing
disappears before everything goes. ;-) What do you mean, you use your
own daemon? Do you mean, your own shell script to start the daemon?


--
/************************************************** *******************\
**
** Joe Yao jsdy@tux.org - Joseph S. D. Yao
**
\************************************************* ********************/

---------------------------------------------------------------------
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


Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 08:19 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.