Re: shell script question

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: JD Austin
Date:  
To: david, Main PLUG discussion list
Subject: Re: shell script question
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:
http://www.twingeckos.com
phone/fax: 480.288.8195

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss