Finding mail per hour


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Finding mail per hour
# 1  
Old 05-22-2008
Question Finding mail per hour

Hi,

i have a logfile of a mail server it looks like this:
d k 1004210238.380677500 1004210238.454490500 1004210238.679567500 3621 <VOLENDAM@Malawi.com> local.EDAM@Frankrijk.com 6053 81

I have got the following script to set the time in normal gmt time
and to filter de failed messages, but i want that the script asks me what date and what time i want to filter at the beginning of the script.

BEGIN{{print "list of failed mails:"}

{print "---------------------------------------------"}}
{if ($1 ~ /d/ && $2 ~ /z/) {nr =nr+1 ; printf $7" ""%s\n%s\n",(""), strftime("%c", $3) }}
END {{print "---------------------------------------------"}
{print "there are:",nr " failed mails"}}




Can anybody help me ?

Greetz Joost

Last edited by Prince2; 05-22-2008 at 06:47 AM..
# 2  
Old 05-22-2008
okay i have the input part its like :

Code:
BEGIN {
                printf "Date ?? (YYYY MM DD HH MM SS) "
                getline date < "-"
                start = mktime(date)
                print "list of failed emails", date
                print "-----------------------------------------------"
}
$1 == "d" && $2 == "d" && $3 >= start {
        nr++
        printf $7 "%s\n%s\n",(""), strftime("%c", $3)
}
END {
                print "-----------------------------------------------"
                print "there are:", nr, "failed emails"
}


But if i type my date at the beginning i have to put all info in there, YYYY,MM,DD,HH,MM,SS


I want that i only have to say the year, month,day

Can some body help me ?
# 3  
Old 05-22-2008
Hi,

Could you tell us pls which mail server you are using?

Regards,
Bash
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies

2. Shell Programming and Scripting

Run the script continously but mail once in 1 hour

Hi, I have a script written for monitoring the queue manager status continously. below is the script. QMGR=`dspmq | awk '{print $1}' | cut -f2 -d "(" | cut -f1 -d ")"` QMSTATUS=`dspmq | awk '{print $2}' | cut -f2 -d "(" | cut -f1 -d ")"` count=`dspmq | awk '{print $1}' | cut -f2 -d "(" | ... (5 Replies)
Discussion started by: Anusha M
5 Replies

3. UNIX for Dummies Questions & Answers

Finding e-mail address using "find" command

any useful command to find and e-mail address hardcoded into a cfg file on an specific server? I already tried with:: find . -type f | xargs grep -l "nobody@foundstone.com" Thanks!! (1 Reply)
Discussion started by: JLo5621
1 Replies

4. Shell Programming and Scripting

E-mail based on crontab hour

I have a cron: 0 5,11,17,23 * * * /home/oracle/scripts/sysize.ksh This cron will trigger cat dbsz.txt | mail -s "$TODAY: PROD DB Size" $RECIPIENTS I don't want to get the e-mail notice 4 times a day. Can I have just one e-mail triggered at 11 AM? Please advise. Thank you (3 Replies)
Discussion started by: Daniel Gate
3 Replies

5. Shell Programming and Scripting

How to convert 24 hour time to 12 hour timing?

Hi friends, I want to convert 24 hour timing to 12 hour please help me... my data file looks like this.. 13-Nov-2011 13:27:36 15.32044 72.68502 13-Nov-2011 12:08:31 15.31291 72.69807 16-Nov-2011 01:16:54 15.30844 72.74028 15-Nov-2011 20:09:25 15.35096 ... (13 Replies)
Discussion started by: nex_asp
13 Replies

6. Shell Programming and Scripting

Script for checking files for last hour and send a mail

Hello, I need to write a script to check the files in one folder , if that folder doesn't have files generated from last 1 hr then we need to send mail to particular persons. So Can you please help me to write script to check the files and send email. Thank you.. (1 Reply)
Discussion started by: archana23
1 Replies

7. UNIX for Advanced & Expert Users

Finding/Grep on files with date and hour in the file name

Hi, I have a folder structure as follows, DATA -> 2012-01-01 -> 00 -> ABC_2012-01-03_00.txt -> 01 -> ABC_2012-01-03_01.txt -> 02 -> ABC_2012-01-03_02.txt ... -> 23 -> ABC_2012-01-03_02.txt -> 2012-01-02 ... (1 Reply)
Discussion started by: mihirvora16
1 Replies

8. Shell Programming and Scripting

Finding/Grep on files with date and hour in the file name

Hi, I have a folder structure as follows, DATA -> 2012-01-01 -> 00 -> ABC_2012-01-03_00.txt -> 01 -> ABC_2012-01-03_01.txt -> 02 -> ABC_2012-01-03_02.txt ... -> 23 -> ABC_2012-01-03_02.txt -> 2012-01-02 -> 2012-01-03 So the dir DATA contains the above hierarchy, User input Start and... (6 Replies)
Discussion started by: mihirvora16
6 Replies

9. UNIX for Advanced & Expert Users

need to configure mail setting to send mail to outlook mail server

i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail. actually i am trying to automate the high... (2 Replies)
Discussion started by: amitranjansahu
2 Replies

10. UNIX for Dummies Questions & Answers

an hour less in 24 hour system

My program: __________________________________ #!/bin/ksh DAY=`date +%y%m%d` H=`date +%H` M=`date +%M` day=`date +%m/%d/%y` let h=$H-1 echo DAY $DAY echo H $H echo M $M echo day $day echo h $h _____________________________________ My result: (3 Replies)
Discussion started by: bobo
3 Replies
Login or Register to Ask a Question