| Summary: | /etc/init.d/httpd will not stop or restart httpd | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Tim Boyer <timothy.boyer> |
| Component: | httpd | Assignee: | Joe Orton <jorton> |
| Status: | CLOSED WORKSFORME | QA Contact: | BaseOS QE Security Team <qe-baseos-security> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.0 | ||
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2011-02-12 15:44:56 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
Thanks for contacting us.
Have you changed the pidfile location in /etc/httpd/conf/httpd.conf, or the /etc/httpd/run symlink (perhaps this is an upgrade from an earlier RHEL)?
Here is what you should see on vanilla RHEL 6 install:
# grep ^PIDFILE /etc/sysconfig/httpd
# grep ^PidFile /etc/httpd/conf/httpd.conf
PidFile run/httpd.pid
# ls -l /etc/httpd/run
lrwxrwxrwx. 1 root root 19 Jan 8 10:57 /etc/httpd/run -> ../../var/run/httpd
# service httpd start
Starting httpd: [ OK ]
# ls /var/run/httpd/
httpd.pid
# service httpd stop
Stopping httpd: [ OK ]
#
Running "rpm -V httpd" will show any files which have changed vs the packaged originals.
w.r.t. to the "daemon" function in /etc/sysconfig/functions - I do not see an obvious problem there. The httpd init script passes --pidfile to daemon, and daemon passes that argument on to __pids_var_run:
# See if it's already running. Look *only* at the pid file.
__pids_var_run "$base" "$pid_file"
which as per the line you quoted:
local pid_file=${2:-/var/run/$base.pid}
picks up $2 as $pid_file.
Joe - Clean install on a newly-provisioned machine. (PROD-BOYER|root@yamato ~)# ls -l /etc/httpd/run lrwxrwxrwx. 1 root root 13 Mar 26 2010 /etc/httpd/run -> ../../var/run ... and there it is. Must have been rsynced over by mistake. My deepest apologies. I thought I had this one nailed; I did not mean this to be a support call. Tim No problem, glad to help; closing out. |
Description of problem: /etc/init.d/httpd does a daemon call to write the httpd.pid file to /var/run/httpd/httpd.pid: pidfile=${PIDFILE-/var/run/httpd/httpd.pid} lockfile=${LOCKFILE-/var/lock/subsys/httpd} RETVAL=0 # The semantics of these two functions differ from the way apachectl does # things -- attempting to start while running is a failure, and shutdown # when not running is also a failure. So we just do it the way init scripts # are expected to behave here. start() { echo -n $"Starting $prog: " LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS but daemon will not look in subdirectories: __pids_var_run() { local base=${1##*/} local pid_file=${2:-/var/run/$base.pid} and the file ends up being created in /var/run, rather than /var/run/httpd: (PROD-BOYER|root@yamato ~)# ls -lad /var/run/httpd* drwx--x---. 2 root apache 4096 Feb 11 14:24 /var/run/httpd (PROD-BOYER|root@yamato ~)# /etc/init.d/httpd start Starting httpd: [ OK ] (PROD-BOYER|root@yamato ~)# ls -lad /var/run/httpd* drwx--x---. 2 root apache 4096 Feb 11 14:24 /var/run/httpd -rw-r--r--. 1 root root 6 Feb 11 15:02 /var/run/httpd.pid (PROD-BOYER|root@yamato ~)# ls -la /var/run/httpd total 8 drwx--x---. 2 root apache 4096 Feb 11 14:24 . drwxr-xr-x. 21 root root 4096 Feb 11 15:02 .. and httpd stop/restart won't find it, and fails: (PROD-BOYER|root@yamato ~)# /etc/init.d/httpd stop Stopping httpd: [FAILED] Version-Release number of selected component (if applicable): How reproducible: Very Steps to Reproduce: 1. /etc/init.d/httpd start 2. /etc/init.d/httpd stop 3. Actual results: (PROD-BOYER|root@yamato ~)# /etc/init.d/httpd stop Stopping httpd: [FAILED] Expected results: (PROD-BOYER|root@yamato ~)# /etc/init.d/httpd stop Stopping httpd: [ OK ] Additional info: Changing the pidfile to pidfile=${PIDFILE-/var/run/httpd.pid} works. Otherwise a number of changes to daemon will have to be made.