LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-17-2003, 05:19 AM   #1
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Rep: Reputation: 30
Sendmail message size


I am trying to calculate how many MB of mail there has been sent to a domain. In the sendmail log i grep for all the "size=" lines. But when i add them up i get to 5078658 kb. This is way to much.

What am i doing wrong this time?

i typed this from command line:
----
grep "Jan 15" /var/log/maillog|grep "from="|grep -v domain.nl|grep -v "to="| awk '{ print $8 }'|sed -e "s/size=//g"|sed -e "s/[,]//g" > /root/mailsize
----

And this as a little script:
----
#!/bin/bash
aantal=$((0))
cat mailsize | while read line; do
aantal=$(($aantal + $line))
echo $aantal
done
----
 
Old 01-17-2003, 08:45 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Shouldn't that be bytes? (Cap b, lowercase b being bits, 8 bits in a Byte): Bytes / 1024 (KBytes) / 1024 (KBytes): "echo 5078658 / 1024 / 1024 | bc -l"

Code:
size_t=0; cat /var/log/maillog | grep "from=" | grep "size=" | cut -d "=" -f 3 | cut -d "," -f 1 | while read size_m; do size_t=$(expr $size_t + $size_m)
echo "aprox   $(echo $size_t / 1024 / 1024 | bc -l | cut -c 0-3) MB"
echo "aprox   $(echo $size_t / 1024 | bc -l | cut -c 0-5) KB"
echo "exactly $size_t Bytes"
echo "exactly $(echo $size_t \* 8 | bc -l ) bits"
done

Last edited by unSpawn; 01-17-2003 at 08:48 AM.
 
Old 01-17-2003, 03:53 PM   #3
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Original Poster
Rep: Reputation: 30
Great! Thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sendmail message clipped GUIPenguin Linux - General 1 05-29-2005 11:02 PM
sendmail message size speed_viper Linux - Software 1 12-17-2004 09:29 PM
sendmail message handling awcool Linux - Software 0 03-12-2004 01:22 PM
gftp: define message size...ssh2 (message_size is too big) pablovschby Linux - Software 2 02-19-2004 11:23 AM
sendmail error message feetyouwell Linux - Software 4 02-16-2004 09:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration