Re: how to do scripting "for X in $LIST"

Re: how to do scripting "for X in $LIST"

am 26.10.2007 06:04:12 von bmynars




http-equiv="Content-Type">


No need for awk:



Joe Philip wrote:

type="cite">



I have a script to check the "df
-k" output. Some of our mount points are permanently 100% full. I
want to check all the mount points except the ones which are in my
list.

 

For example, I want to modify the
following script so that it checks all the mount points which are
more than 98% full except the ones on the FULL_LIST. What is the
corrent syntax to do this line:

     if  [
mnt_pt not in $FULL_LIST ]; then

 

------------------------------------------------------------ ---------------------------------


#!/bin/ksh


FULL_LIST="/u110
/u05"


df -k | grep -iv filesystem | awk '{
print $6" "$5}' | while read LINE; do




df -k |\

while read -A REC; do

    [[ ${REC[5]} == +([[:digit:]]) || && ${REC[6]} ==
+([[:digit:])) ]] || continue

    print Do something here.

done

type="cite">

PERC=`echo $LINE | cut -d"%" -f1 |
awk '{ print $2 }'`


TST=`echo $LINE | cut -d"%" -f1 |
awk '{ print $1 }'`


if [ $PERC -gt 98 ]; then


    if  [
mnt_pt not in $FULL_LIST ]; then


    echo "${PERC}% ALERT" | Mail -s
"${LINE} on `hostname` is almost full" 
moz-do-not-send="true" href="mailto:mail@mail.com"> size="2">mail@mail.com


    fi


fi


done



 





Re: how to do scripting "for X in $LIST"

am 26.10.2007 09:40:15 von huge

On 2007-10-26, Bolek Mynarski wrote:
>
>
>

Please don't do this. Usenet is a plain text medium.

--
"Be thankful that you have a life, and forsake your vain
and presumptuous desire for a second one."
[email me at huge {at} huge (dot) org uk]

Re: how to do scripting "for X in $LIST"

am 26.10.2007 10:49:13 von Michael Tosch

Bolek Mynarski wrote:
> No need for awk:
>
> Joe Philip wrote:
>> I have a script to check the "df -k" output. Some of our mount points
>> are permanently 100% full. I want to check all the mount points except
>> the ones which are in my list.
>>
>> For example, I want to modify the following script so that it checks
>> all the mount points which are more than 98% full except the ones on
>> the FULL_LIST. What is the corrent syntax to do this line:
>> if [ mnt_pt not in $FULL_LIST ]; then
>>
>> ------------------------------------------------------------ ---------------------------------
>>
>> #!/bin/ksh
>>
>> FULL_LIST="/u110 /u05"
>>
>> df -k | grep -iv filesystem | awk '{ print $6" "$5}' | while read LINE; do
>>
> df -k |\
> while read -A REC; do
> [[ ${REC[5]} == +([[:digit:]]) || && ${REC[6]} == +([[:digit:])) ]]
> || continue
> print Do something here.
> done
>>
>> PERC=`echo $LINE | cut -d"%" -f1 | awk '{ print $2 }'`
>>
>> TST=`echo $LINE | cut -d"%" -f1 | awk '{ print $1 }'`
>>
>> if [ $PERC -gt 98 ]; then
>>
>> if [ mnt_pt not in $FULL_LIST ]; then
>>
>> echo "${PERC}% ALERT" | Mail -s "${LINE} on `hostname` is almost
>> full" mail@mail.com
>>
>> fi
>>
>> fi
>>
>> done
>>
>>
>

case $FULL_LIST in
*$mnt_pt*)
;; # excluded
*)
echo do something with $mnt_pt
;;
esac

To make the match more exact, you should do
FULL_LIST=" /u110 /u05 "

and use the match
*\ $mnt_pt\ *)


--
Michael Tosch @ hp : com

Re: how to do scripting "for X in $LIST"

am 27.10.2007 04:37:31 von Allodoxaphobia

On Fri, 26 Oct 2007 00:04:12 -0400, Bolek Mynarski wrote:
> !DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> html>
> head>
> > http-equiv="Content-Type">
>
>
> No need for awk:


And, definitely *no* need for HTML in usenet.