Last 24 hours of /var/mail/root/


 
Thread Tools Search this Thread
Special Forums Cybersecurity Last 24 hours of /var/mail/root/
# 1  
Old 11-20-2009
Last 24 hours of /var/mail/root/

Hi there,

I'm using this command line to get a daily mail through crontab with the content of /var/mail/root:

mailx -s "Test My Server" mymail@mail.com </var/mail/root

and it works fine, but I'd like to get only the information updated in the last 24 hours.

Thanks in advance for any suggestions,

GB
# 2  
Old 11-24-2009
AFAIK this is not a Linux Security forum question but OK. /var/spool/mail contents are basically plain text files (mbox format) so egrepping for ^Date (as in `date +'%a, %d %b %Y'`) and ^Subject could help narrow things down. Shouldn't be too hard to script.
# 3  
Old 11-27-2009
Thanks Smilie ... now it works!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

[SOLVED] Root mail going to user "mail" instead of root

I running Linux Mint Debian Edition tracking testing and have started a cron job that will send something to the root mailbox. Mint has heirloom and exim4 installed. However, mail was getting nothing. I realized that in /etc/aliases, there was a line root: mintSince you can't log into the mint... (0 Replies)
Discussion started by: Narnie
0 Replies

2. Shell Programming and Scripting

PHP Mail Script Takes Hours to Send emails

guys, i have a php script that i wrote that takes hours to send emails to recipients. i can't post the content of this script in here because the script contains some very important confidential information. so my question is, why is it that when the php script runs, it runs successfully, but... (3 Replies)
Discussion started by: SkySmart
3 Replies

3. Shell Programming and Scripting

importance of /var/mail

Hi When an entry will be made to the file /var/mail/<user-id> . I have 100 scripts under a specific user id(dgircc) in cron .SO inrder to check the whether the script has sucessfully run or not and if not to generate an email if i mention the code like #!/bin/ksh -p 2 fsize=`ls -lrt... (0 Replies)
Discussion started by: mskalyani
0 Replies

4. UNIX for Dummies Questions & Answers

Parse /var/mail

Hi all... We have a box that receives a lot of incoming emails. I have a .procmailrc file that in turn invokes a python script, which process each of these incoming email. All is nice and good. However, before the .procmailrc and python script were in place, we still were receiving emails and... (0 Replies)
Discussion started by: khader69
0 Replies

5. UNIX for Dummies Questions & Answers

/var/spool/mail

Hi, How can i get my mail on either /var/spool/mail or /var/mail? I use mail and sendmail command to send mail. But everytime I send mail it comes to my outlook inbox and when I check with mail command I get the message "No mail for siba". (Note siba is my user Id.) (2 Replies)
Discussion started by: siba.s.nayak
2 Replies

6. 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

7. Solaris

how to forward mail in /var/mail/username to external mail

Dear All, Now I use solaris 10 and I try to forward mail from /var/mail/username to their external mail so what should I do? thank u in advance (2 Replies)
Discussion started by: unitipon
2 Replies

8. UNIX for Dummies Questions & Answers

Can I zero var/spool/mail/mail

The mail file in the directory var/spool/mail is very large. Can I zero this (>) without losing any unopened mails there may be? There are about 10 mail accounts. Using RedHat Linux. Thanks in advance. (0 Replies)
Discussion started by: dennisheazle
0 Replies

9. Shell Programming and Scripting

READING mail from /var/mail/user

Hello guys, I'm in desperate need. I need to write a script that behaves like a "mail" shell program. I've a base of the program -menu and so on, but what I cannot do is how to read messages from /var/mail/user. I would like to separate them as "mail" program does, but I;m just a newbie and... (21 Replies)
Discussion started by: petoSVK
21 Replies

10. UNIX for Dummies Questions & Answers

Unix IMAP e-mail via Outlook showing +10 hours

Multiple users at my work are connecting to a UNIX IMAP e- mail server via Outlook 2003 that is creating a small problem. Random new e-mails repeat themselves up to 3 times with an additional 10 hours added to them of when the original arrived. i.e Original e-mail marked arrived at 10:00am... (2 Replies)
Discussion started by: arkady
2 Replies
Login or Register to Ask a Question