Bug 325511

Summary: Wrong return code from init script
Product: Red Hat Enterprise Linux 4 Reporter: David Kovalsky <dkovalsk>
Component: tog-pegasusAssignee: Vitezslav Crhonek <vcrhonek>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.5CC: benl
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2008-0677 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-07-24 19:34:09 UTC Type: ---
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: 245337    
Bug Blocks: 326281    

Description David Kovalsky 2007-10-09 20:13:57 UTC
+++ This bug was initially created as a clone of Bug #245337 +++

.qa.[root@amd64-4as tps]# service tog-pegasus start
Starting up CIM server:                                    [  OK  ]
.qa.[root@amd64-4as tps]# service tog-pegasus stop
Shutting down CIM server:                                  [  OK  ]
.qa.[root@amd64-4as tps]# service tog-pegasus stop
Shutting down CIM server:                                  [FAILED]
.qa.[root@amd64-4as tps]# echo $?
1
^^

This return code is wrong. It should either be 7 (according to
http://intranet.corp.redhat.com/ic/intranet/InitscriptsSpec.html) 

.qa.[root@amd64-4as tps]# rpm -q tog-pegasus
tog-pegasus-2.5.1-5.EL4.x86_64

Comment 2 David Kovalsky 2007-10-10 12:30:38 UTC
Also the return code of the status command is wrong when the pid file exists:

# Make sure tog-pegasus service is started and
# set the immutable attribute so that the pid file does not get removed
# or you just create the pid file while the service is stopped

.qa.[root@ppcp-4as-bos ~]# service tog-pegasus start
Starting up CIM server:                                    [  OK  ]

.qa.[root@ppcp-4as-bos ~]# chattr +i /var/run/tog-pegasus/cimserver.pid

.qa.[root@ppcp-4as-bos ~]# service tog-pegasus stop
rm: cannot remove `/var/run/tog-pegasus/cimserver.pid': Operation not permitted
                                                           [  OK  ]

# Check the status
.qa.[root@ppcp-4as-bos ~]# service tog-pegasus status
CIM server is not running
.qa.[root@ppcp-4as-bos ~]# echo $?
3

According to http://intranet.corp.redhat.com/ic/intranet/InitscriptsSpec.html
this should be 1 - program is dead and /var/run pid file exists

Very similar with the lock file, where the return value should be 2.

Comment 3 David Kovalsky 2007-10-10 12:43:44 UTC
Another thing to think about is the return code of `service tog-pegasus stop'
which is 0 even if lock/run file is not removed. IMO this shouldn't be zero as
the shutdown wasn't 100% successful. 

Note that this isn't an artifical situation - this can simply happen when the
filesystem with /var is remounted read-only. 

Comment 5 RHEL Program Management 2007-11-29 03:57:09 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 10 errata-xmlrpc 2008-07-24 19:34:09 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2008-0677.html