script to read from mail


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script to read from mail
# 1  
Old 10-03-2006
script to read from mail

Hi,

I have a requirement in which I have to read mail from a unix text file and scan records having
failed records (any number > 0)

Firstly it should compare the file creation_date with sysdate
if the dates match then
do the checking for failed records

sample file i/p

Staged 0 records from <file_name> (2 failed)
Staged 0 records from <file_name> (0 failed)
Staged 0 records from <file_name> (0 failed)

09/27 12:45:46 I 0 Error Transactions
09/27 12:45:46 I 0 Error Transactions
09/27 12:45:46 I 0 Error Transactions


code:

var1=`grep -w "0 failed" <file_name>
var2=`grep -w "0 Error" <file_name>
if [[ -n $var1 || -n $var2 ]]; then
..... do something .....
else
..... do something .....
fi;


Is there any way I can do in a single command using sed
including the file date comparison with sysdate ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to Read mail in a UNIX server?

My unix server is somehow configured to send mail to any id in my network. However, how do I read the mails in my inbox. I can send mails using mailx -s However, when I try to check whether there is mail using mailx -e it shows invalid option. (2 Replies)
Discussion started by: srkmish
2 Replies

2. UNIX for Advanced & Expert Users

Read mail attachments in AIX

Hello All, Is there a way to read/view email attachments in AIX? Here's my scenario; I have users that will being scanning documents for digital storage. To make it easier for the users, I would like for them to scan and email the pdf version of the document directly to one of my AIX... (3 Replies)
Discussion started by: bbbngowc
3 Replies

3. OS X (Apple)

Read and manage mail under Terminal

When opening Terminal window under Mac OS Lion, I have a message saying I've got mail . It seems to be somewhere close to ~/Library/Server/Mail/Data/spool/ but I ignore what command to be typed in order to read it and suppress it later once read. (1 Reply)
Discussion started by: shub22
1 Replies

4. UNIX for Dummies Questions & Answers

read mail question

how do I save a email I just read to a new file? Thanks. (3 Replies)
Discussion started by: drew211
3 Replies

5. Shell Programming and Scripting

script to read mail

Hi, I want to write a script that will read mail ( for eg: from abc.def@yahoomail.com ). And if it finds a particular subject then do something.. Is it possible.... Please help... Thanks in adv.. (8 Replies)
Discussion started by: PRKS
8 Replies

6. Shell Programming and Scripting

script to read mail on a mail server

Hi All, Is there any way Unix shell script can directly read a mail on a mail server (for eg. abc@xyz.com) and save it as a text file in a unix directory ? Thanks PRKS ---------- Post updated at 08:37 AM ---------- Previous update was at 08:36 AM ---------- I am using ksh (1 Reply)
Discussion started by: PRKS
1 Replies

7. UNIX for Advanced & Expert Users

How to read mail attachement

I want to read attachements sent to unix mail id and save the attachement in folder. I may receive the mails from different mail clients(outlook, lotus ..etc). Attachements are in CSV(comma saperate) format. Let me know the shell script code for this. Regards, Venkat (1 Reply)
Discussion started by: svenkatareddy
1 Replies

8. UNIX for Dummies Questions & Answers

How do I read mail in /var/spool/mail?

How can I read mail sent to /var/spool/mail? I do not have pine installed so forget about that...is there some generic utility I can use? (3 Replies)
Discussion started by: mojoman
3 Replies

9. UNIX for Dummies Questions & Answers

How to mark ALL mail items as read?

Hi guys. Does anyone know if there is a mail command that will allow you to flag all mail items as being read? I've checked out the man mail pages, but can't seem to find what I'm looking for. :confused: We are running UNIX AIX 5.2. Thanks in advance, Kev (3 Replies)
Discussion started by: Krispy
3 Replies

10. UNIX for Dummies Questions & Answers

Tell UW-Imap to read /var/mail/mailbox ??

Hi, I've got UW-IMAP installed on Gentoo. I'm using EXIM as the transfer agent. EXIM is working fine (I think)... all incoming mail - external and internal goes to /var/mail/username file. I can verifiy this by reading this file directly with nano. Also, IMAPd is running. It lets me login... (2 Replies)
Discussion started by: d11wtq
2 Replies
Login or Register to Ask a Question
runacct(1M)															       runacct(1M)

NAME
runacct - run daily accounting SYNOPSIS
[mmdd[state]] DESCRIPTION
runacct is the main daily accounting shell procedure. It is normally initiated via cron(1M). runacct processes connect, fee, disk, and process accounting files. It also prepares summary files for prdaily or billing purposes. runacct takes care not to damage active accounting files or summary files in the event of errors. It records its progress by writing descriptive diagnostic messages into When an error is detected, a message is written to mail (see mail(1), mailx(1), or elm(1)) is sent to and and runacct terminates. runacct uses a series of lock files to protect against re-invocation. The files and are used to prevent simultaneous invocation, and is used to prevent more than one invocation per day. runacct breaks its processing into separate, restartable states using to remember the last state completed. It accomplishes this by writ- ing the state name into runacct then looks in to see what it has done and to determine what to process next. states are executed in the following order: Move active accounting files into working files. Verify integrity of file, correcting date changes if necessary. Produce connect session records in format. Convert process accounting records into format. Merge the connect and process accounting records. Convert output of chargefee into format and merge with connect and process accounting records. Merge disk accounting records with connect, process, and fee accounting records. Merge the daily total accounting records in with the summary total accounting records in Produce command summaries. Any installation-dependent accounting programs can be included here. Cleanup temporary files and exit. To restart runacct after a failure, first check the file for diagnostics, then fix up any corrupted data files such as or The files and file must be removed before runacct can be restarted. The argument mmdd is necessary if runacct is being restarted, and specifies the month and day for which runacct will rerun the accounting. Entry point for processing is based on the contents of to override this, include the desired state on the command line to designate where processing should begin. EXAMPLES
To start runacct. To restart runacct. To restart runacct at a specific state. WARNINGS
Normally it is not a good idea to restart runacct in its state. Run manually, then restart via: If runacct failed in its state, remove the last file because it will not be complete. FILES
SEE ALSO
mail(1), acct(1M), acctcms(1M), acctcom(1M), acctcon(1M), acctmerg(1M), acctprc(1M), acctsh(1M), cron(1M), fwtmp(1M), acct(2), acct(4), utmp(4). STANDARDS CONFORMANCE
runacct(1M)