Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 28681

Summary: samba init script problem
Product: Gentoo Linux Reporter: sthom <sthom>
Component: New packagesAssignee: Donny Davies (RETIRED) <woodchip>
Status: RESOLVED INVALID    
Severity: normal    
Priority: High    
Version: 1.0   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: full script with modified stop function

Description sthom 2003-09-14 03:31:52 UTC
Hi, 
 
I made a modification to the samba script for stopping the daemon. Sometimes  
the nmbd is not started and then it is not possible to stop via init script even the 
process smbd. Fixed this in the script by reading the 'ps ax' and checking the  
pid-files, too. This is working fine. Would be great if this still works in  
future ebuids. 
 
Regards 
Sascha 
 
--- my modified stop() part ----------- 
 
stop() { 
        ebegin "Stopping samba" 
        ebegin "    smbd" 
        filepsid=$(cat /var/run/samba/smbd.pid) 
        # echo "smbd should run on ps: $filepsid" 
        psid=$(ps -p $filepsid | tail -1 | cut -d ' ' -f 2) 
        # echo $psid 
        if [ "$filepsid" = "$psid" ] ; then 
                start-stop-daemon --stop --quiet --pidfile /var/run/samba/smbd.pid 
                result=$? 
        else 
                echo "        ...was not running." 
                echo "" > /var/run/samba/smbd.pid 
        fi 
 
        ebegin "    nmbd" 
        filepsid=$(cat /var/run/samba/nmbd.pid) 
        # echo "nmbd should run on ps: $filepsid" 
        psid=$(ps -p $filepsid | tail -1 | cut -d ' ' -f 2) 
        # echo $psid 
        if [ "$filepsid" = "$psid" ] ; then 
                start-stop-daemon --stop --quiet --pidfile /var/run/samba/nmbd.pid 
                result=$(( $result + $? )) 
        else 
                echo "        ...was not running." 
                echo "" > /var/run/samba/nmbd.pid 
        fi 
        eend $result 
}
Comment 1 sthom 2003-09-14 03:33:03 UTC
Created attachment 17683 [details]
full script with modified stop function
Comment 2 Donny Davies (RETIRED) gentoo-dev 2003-09-25 14:18:12 UTC
I dont like this.  Why arent your daemons running I wonder?
Comment 3 Donny Davies (RETIRED) gentoo-dev 2004-02-14 22:20:55 UTC
i dont think theres a bug here!