Bug 187072

Summary: /usr/local/etc.rc.d/nslcd status returns 0 even when service is not running
Product: Ports & Packages Reporter: takeda
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description takeda 2014-02-25 20:50:00 UTC
/usr/local/etc.rc.d/nslcd status always returns 0 this in turn fools programs like (salt in my case) to think that the service is running while it is not.

Fix: 

The least invasive way is to basically add "return 1" when service is not running, like this:

nslcd_status()
{
        nslcd_findpid
        if [ ! ${mypid} = '' ]; then
                echo "${name} is running with PID ${mypid}.";
        else
                echo "${name} not running?";
                return 1
        fi
}
How-To-Repeat: root@salt-testing:~ # /usr/local/etc/rc.d/nslcd status
nslcd is running with PID 67408.
root@salt-testing:~ # echo $?
0
root@salt-testing:~ # /usr/local/etc/rc.d/nslcd stop
Stopping nslcd.
Waiting for PIDS: 67408.
root@salt-testing:~ # /usr/local/etc/rc.d/nslcd status
nslcd not running?
root@salt-testing:~ # echo $?
0
Comment 1 takeda 2014-02-25 22:42:45 UTC
Please close this bug, I opened 
http://www.freebsd.org/cgi/query-pr.cgi?pr=187073 which properly tags 
which port it is regarding.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2014-02-25 23:23:10 UTC
State Changed
From-To: open->closed

Closed at submitter's request.