| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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 |
|
#2
| |||
| |||
| 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 |
|
#3
| |||
| |||
| 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 |
|
#4
| |||
| |||
| 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 |
|
#5
| |||
| |||
| 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 |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.