David wrote:

What is the point of the below in a script?  This snippage is in the 'stop' portion of an init script.  I just dont see the point of the if statement. It almost looks like it's just making sure $pid isn't empty.


------begin snippet------

pid=`/bin/ps -e | grep process_name | grep -v mon | grep -v grep | sed -e 's/^  *//' -e 's/ .*//' | head -1`
    if [ "X$pid" != "X" ]
    then
            /bin/kill $pid
            echo "**process_name** interface stopped"
    fi
------end snippet------

Thanks,
David


It's preventing it from killing a process that isn't running /usr/bin/kill by itself will error.
-- 
JD Austin
Twin Geckos Technology Services LLC
email: jd@twingeckos.com
http://www.twingeckos.com
phone/fax: 480.288.8195