[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: UUencode and emails problems
From: |
Bruce Korb |
Subject: |
Re: UUencode and emails problems |
Date: |
Wed, 26 Aug 2015 16:16:16 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
On 08/26/15 11:44, RALPH ABI RACHED wrote:
WEEKDAY=`date '+%a'`
if [[ "$WEEKDAY" = "Sun" ]]
then
print "Week Number,From,To,Idle Average (%),Load Average (%)" >
$TRASH/week_avg.sar
SAR_FILES_COUNT=`ls -ltr ${SAR_ARCHIVE_DIR}/sar_${THIS_YEAR}* | wc -l`
let i=1
while (( i < SAR_FILES_COUNT ))
do
let j=i+7
ls -ltr ${SAR_ARCHIVE_DIR}/sar_${THIS_YEAR}* | awk '{print $9}' |
sed -n "${i},${j}p" | xargs grep Average > $TRASH/temp.sar
let SUM=0
while read LINE
do
IDLE_VAL=`echo -e $LINE | awk '{print
$5}'`
let SUM=SUM+IDLE_VAL
done < $TRASH/temp.sar
let AVG=SUM/7
FIRST_DAY=`sed -n '1p' $TRASH/temp.sar | awk -F_
'{print $3}' | awk -F: '{print $1}'`
LAST_DAY=`sed -n '7p' $TRASH/temp.sar | awk -F_
'{print $3}' | awk -F: '{print $1}'`
let WEEK_NUMBER=${j}/7
let LOAD_AVG=100-AVG
print
"${WEEK_NUMBER},${FIRST_DAY},${LAST_DAY},${AVG},${LOAD_AVG}" >>
$TRASH/week_avg.sar
let i=j
done
uuencode $TRASH/week_avg.sar weekly_avg_$CURRENT_DATE.csv >>
/svw/svwtst1b/work/billops/temp_mail.sar
fi
echo -e $TXT_MAIL >> /svw/svwtst1b/work/billops/temp_mail.sar
nail -r "BOP" -s "System Activity Reporter" $TO <
/svw/svwtst1b/work/billops/temp_mail.sar
Wow.
A) why not just "tar -cJf" it and attach using MIME.
B) if you have to roll your own, wny not use "shar"?
it just does all that stuff for you.
C) you can use compression options with shar, too,
to make it much moore compact than just "uuencoding"
all the files
D) *plus* if files meet the criteria for "text" files,
the uuencoding step can be skipped.
So, what are you really trying to accomplish?