Bug 218747 - httpd init script returns error code when called more than once
httpd init script returns error code when called more than once
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: initscripts (Show other bugs)
4.4
All Linux
medium Severity medium
: ---
: ---
Assigned To: initscripts Maintenance Team
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-12-07 04:25 EST by Satoru SATOH
Modified: 2007-11-16 20:14 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-10-22 16:00:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
The patch for /etc/init.d/httpd that checks httpd's process running (stopped) before starting (stopping) it. (1.15 KB, patch)
2006-12-07 04:25 EST, Satoru SATOH
no flags Details | Diff

  None (edit)
Description Satoru SATOH 2006-12-07 04:25:40 EST
Description of problem:
If /etc/init.d/httpd is executed while httpd is stopped, it returns error code 1.


Version-Release number of selected component (if applicable):
httpd-2.0.52-28.ent

How reproducible: always


Steps to Reproduce:
1. /etc/init.d/httpd start (or make sure it's running.)
2. /etc/init.d/httpd stop; echo $?
3. /etc/init.d/httpd stop; echo $?
  
Actual results:
See the following log. 
(httpd.org is original one, httpd is patched version.)

[root@node01 init.d]# /etc/init.d/httpd start
Starting httpd:                                            [  OK  ]
[root@node01 init.d]# ./httpd.org stop; echo $?
Stopping httpd:                                            [  OK  ]
0
[root@node01 init.d]# ./httpd.org stop; echo $?
Stopping httpd:                                            [FAILED]
1
[root@node01 init.d]# ./httpd stop; echo $?
httpd is already stopped.
0
[root@node01 init.d]# ./httpd start; echo $?
Starting httpd:                                            [  OK  ]
0
[root@node01 init.d]# ./httpd.org start; echo $?
Starting httpd:
0
[root@node01 init.d]# ./httpd.org start; echo $?
Starting httpd:
0
[root@node01 init.d]# ./httpd start; echo $?
httpd is already started.
0
[root@node01 init.d]# rpm -q httpd
httpd-2.0.52-28.ent
[root@node01 init.d]#


Expected results:
httpd init script returns 0 no matter how many times started/stopped.

Additional info:
See corresponding LSB section also,

---------------------------------------------------------------------------
In addition to straightforward success, the following situations 
are also to be considered successful:
    ...
    * running start on a service already running
    * running stop on a service already stopped or not running
    ...
---------------------------------------------------------------------------

[
Linux Standard Base Core Specification 3.1
20.2. Init Script Actions
http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
]
Comment 1 Satoru SATOH 2006-12-07 04:25:40 EST
Created attachment 143041 [details]
The patch for /etc/init.d/httpd that checks httpd's process running (stopped) before starting (stopping) it.
Comment 2 Joe Orton 2006-12-14 10:53:21 EST
There are, IIRC, many ways in which our init scripts defiate from LSB-standard
requirements.

The return value from the init script derives directly from the killproc()
standard function, which oddly seems to vary by "$LSB" variable definition.  If
this is to be fixed, why not fix it in killproc()?

In any case; it would not be impossible for users to depend on the fact that a
successful return from "service httpd stop" meaning "service not running" which
would make this an interface change.  I'm not convinced this is a good idea.
Comment 4 Joe Orton 2007-10-22 15:45:40 EDT
This seems to be fixed in RHEL5 courtesy of the changes to killproc(); the httpd
init script is unchanged between 4 and 5.

As mentioned above: the behaviour implemented by the httpd init script is just
that provided by the standard initscript killproc() function.

Again: I do not think we would be a good idea to change this behaviour in a RHEL
4 update release, since it would not be implausible that it would cause a
regression in some customer environment.  Re-assigning to initscripts maintainer
for final decision.
Comment 5 Bill Nottingham 2007-10-22 16:00:36 EDT
See bug 151104 - we're not going to change behavior for RHEL 4 in a way that may
break third-party scripts.

Note You need to log in before you can comment on or make changes to this bug.