Welcome to the Linux Foundation Forum!

email from sar and parsar out put

Hi,

I am using a script to send email from parsar / sar command if there is a specific value for CPU usage, If condition is not working but I can see the variable declared in echo command

I am using following script for send email from parsar command, If I comment if and then line then echo is working but script is not working with if condition

==============================

parsar --peakonly --daily > peakonly_daily

result1=$(grep "6.9" peakonly_daily)

if [ "$result1" = "6.9" ];

then

echo $result1

#mail -s "Web-03: Daily and Peakonly Utilization of Memory and CPU" ashams@techlogix.com < peakonly_daily

fi;

==============================

can any one help me to resolve this issue

Regards

Asif Shams

Comments

  • here is the out put of peakonly_daily file

    TIMESTAMP CPU% IOWAIT% MEM USED MEM FREE SWAP USED
    ----



    07/26:peak 5.4 3.7 3093.4M 6551.6M 74.6M
    07/27:peak 6.9 3.6 4076.4M 6689.8M 74.6M
    07/28:peak 6.0 3.6 4076.1M 6445.4M 74.6M
    07/29:peak 5.3 3.7 2122.8M 6666.6M 74.6M
    07/30:peak 8.8 3.6 3702.1M 6667.9M 74.1M
    07/31:peak 5.3 4.1 2700.9M 5897.9M 74.1M
    08/01:peak 5.7 3.8 2717.2M 6017.6M 74.1M
    08/02:peak 6.7 3.8 4723.9M 6074.6M 74.1M

    I want if I get the value equal to 6.7 or 6.9 I should get email from system

    Regards
    Asif Shams

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training