Bug 521195

Summary: psacct initscript review
Product: [Fedora] Fedora Reporter: Michal Nowak <mnowak>
Component: psacctAssignee: Ivana Varekova <varekova>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhideCC: dkovalsk, ohudlick, varekova
Target Milestone: ---Keywords: EasyFix
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-16 07:40:25 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:    
Bug Blocks: 521669    

Description Michal Nowak 2009-09-04 09:08:44 UTC
Description of problem:

Reviewed psacct's initscript and found few minor caveats or incompatibilities with https://fedoraproject.org/wiki/FCNewInit/Initscripts

Version-Release number of selected component (if applicable):

psacct-6.3.2-53.fc11.x86_64

Actual results:

---[1]---------------------------------------------------------
"""
  *)
        # do not advertise unreasonable commands that there is no reason
        # to use with this device
        echo $"Usage: $0 {start|stop|status|restart|reload}"
        exit 1
"""
Should be better: exit 2, or exit 3
---[2]---------------------------------------------------------
"""
start()
        if [ -r $ACCTFILE ]; then
            ...
        else
            exit 1
        fi
"""
Should be better: exit 4 (aka: 4 user had insufficient privilege)
---[3]---------------------------------------------------------
"""
start()
            if [ $RETVAL -eq 0 ]; then
                ...
            else
                exit 3
            fi
"""
Should be better: exit 7 (aka: 7 program is not running)
---[4]---------------------------------------------------------
"""
stop()
        if [ $RETVAL -eq 0 ]; then
            ...
            exit 3
        else
            exit 0
        fi
"""
Should be better: exit 0 (or no exit at all) and exit 1 (on the second "exit" line), so, stopping service ends with exit code == 0 in case of success.

Comment 1 Ivana Varekova 2009-09-16 07:40:25 UTC
Fixed in psacct-6.3.2-55.