Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Check for new mail from console; watch for mail with tail.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Carlos
Guru
Guru


Joined: 07 Aug 2002
Posts: 458
Location: Providence, RI

PostPosted: Tue Feb 18, 2003 12:59 pm    Post subject: Check for new mail from console; watch for mail with tail. Reply with quote

I just wrote a script, called "mail?", that will go through my ~/.maildir and print out the date, subject, and from header lines from all new messages, separated by blank lines and preceded by the current date and time. The script's very short:
Code:
#!/bin/bash
echo -n "New mail as of "
date '+%d %b %R:%S:'
for i in `find ~/.maildir/ -name new`; do  for j in `find $i/ -type f`; do echo; gawk -F: '/^From|^Subject|^Date/' $j; done; done
This is useful for me because so far I have three subdirectories that mail gets put into by procmail, and opening up mutt to see if I have mail would be a pain even with only one mailbox.

Why don't I use a dock app or something to monitor my mailboxes? First of all, I like to be able to see who sent the messages, since some messages aren't urgent, whereas an indicator that only tells me that I have mail - and nothing else - will have me opening up mutt in mere seconds. Also, Ion, my WM of choice, doesn't have a bar.

I don't use biff because it's not in Portage, and I want to run the program on my own instead of being told that I have mail. Actually, I added this job to my crontab:
Code:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * fetchmail &> /dev/null; ~/scripts/mail? >> ~/.newmail
Before I just had fetchmail running, but now I check for new mail after that. I have a console running tail -f on ~/.newmail (actually it's in the workspace that's running top, iptraf, and xtail monitoring all the log files in /var/log)so I'm immediately apprised of incoming mail, and in detail too.

I'm just hoping maybe one person finds this useful, since most people will be sticking with their dockapps and panel applets and such.
_________________
Man must shape his tools lest they shape him.
Back to top
View user's profile Send private message
tukem
Tux's lil' helper
Tux's lil' helper


Joined: 25 Jun 2002
Posts: 114
Location: Tampere, Finland

PostPosted: Tue Feb 18, 2003 1:31 pm    Post subject: Reply with quote

Nice script. I just wondered why don't you just say:
*/5 * * * * fetchmail &> /dev/null; ~/scripts/mail? >> ~/.newmail
in crontab instead of listing all those times.
Back to top
View user's profile Send private message
Carlos
Guru
Guru


Joined: 07 Aug 2002
Posts: 458
Location: Providence, RI

PostPosted: Tue Feb 18, 2003 9:11 pm    Post subject: Reply with quote

tukem wrote:
Nice script. I just wondered why don't you just say:
*/5 * * * * fetchmail &> /dev/null; ~/scripts/mail? >> ~/.newmail
in crontab instead of listing all those times.
Oh, good point. I wrote that line in my crontab (with juts the fetchmail, not the new script) back when I didn't know you could do that.
_________________
Man must shape his tools lest they shape him.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum