Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 824680

Summary: rhsmcertd init script status return 0 if the service is stopped
Product: Red Hat Enterprise Linux 5 Reporter: Mark Huth <mhuth>
Component: subscription-managerAssignee: Adrian Likins <alikins>
Status: CLOSED ERRATA QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.8CC: alikins, awood, bkearney, fsharath, jmolet, lmiksik, mtaru
Target Milestone: rcKeywords: EasyFix, Patch
Target Release: 5.9   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 842464 895263 (view as bug list) Environment:
Last Closed: 2013-01-08 03:52:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 771481, 771748, 842464, 895263    
Attachments:
Description Flags
Capture the return value from status $PROG none

Description Mark Huth 2012-05-24 00:57:19 UTC
Description of problem:

We have a small problem with the return code of the init script of the subscription-manager package which is incorrect. If you do a /etc/init.d/rhsmcertd status, the return code is 0 even if the service is stopped. For other init script I can see that status return 0 when the service is running and another value when it's not.

[root@sv0287 ~]# /etc/init.d/rhsmcertd status
rhsmcertd is stopped
[root@sv0287 ~]# echo $?
0
[root@sv0287 ~]# /etc/init.d/cpuspeed status
cpuspeed is stopped
[root@sv0287 ~]# echo $?
3

According to the Linux standard base (lsb), the sevice xxx status command exit status should have the following meanings:

0	program is running or service is OK
1	program is dead and /var/run pid file exists
2	program is dead and /var/lock lock file exists
3	program is not running
4	program or service status is unknown

Version-Release number of selected component (if applicable):
subscription-manager-0.96.17-1.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. service rhsmcertd stop
2. service rhsmcertd status
3. Returns 0 even though the service is not running
  
Actual results:
service rhsmcertd status returns 0 when the program isn't running

Expected results:
service rhsmcertd status returns 3 when the program isn't running

Additional info:
Happens with rhsmcertd on RHEL5 as well, but I haven't created a separate bug for it.

Comment 1 Mark Huth 2012-05-24 01:02:10 UTC
Created attachment 586500 [details]
Capture the return value from status $PROG

Comment 3 Adrian Likins 2012-05-25 14:07:48 UTC
Looks easy enough, seems to work.

Comment 4 Alex Wood 2012-06-13 18:10:45 UTC
Fixed in 7c414818259b9ef012b72de2f399ea271aa39c2e

Comment 5 Sharath Dwaral 2012-06-25 13:17:13 UTC
Version:

RHEL 5.9

# rpm -qa | egrep "subscription-manager|python-rhsm"
subscription-manager-migration-1.0.4-1.git.1.b28337e.el5
subscription-manager-migration-data-1.11.1.1-1.git.2.c7fbafe.el5
python-rhsm-1.0.2-1.git.2.d5c3d05.el5
subscription-manager-firstboot-1.0.4-1.git.1.b28337e.el5
subscription-manager-1.0.4-1.git.1.b28337e.el5
subscription-manager-gui-1.0.4-1.git.1.b28337e.el5

Actual Result:

# service rhsmcertd stop
Stopping rhsmcertd                                         [  OK  ]
# service rhsmcertd status
rhsmcertd is stopped
# echo $?
3

Bug Verified

Comment 9 errata-xmlrpc 2013-01-08 03:52:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0033.html