Dear all,
Sorry for the delay in sending the summary .
My original question was :
>
> How can I trigger a new message ?
> basically what I want to do is to run a command , like a bell or a
> special sound when a message comes, so is there a way in sendmail to run
> a shell script upon receiving new mail ?
> I am running pine version 3.91 , I can use xbiff, but that doesn't do
> what I wnat .
>
Thanks to all who replied :
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-------------------------- S T A R T O F R E P L I E S ------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
1 )
There is a separate executable called "newmail" that comes or
is built with the "elm" distribution that may do what you want.
If you have elm installed, look for a man page on newmail.
Good Luck,
Barrett
barrett_at_ra.me.wisc.edu
-----------------------------------------------------------------------------------------------
2 )
Hy,
you can use the biff command. It is enough to put the line
biff y
in your $HOME/.login. This does the job. For more informations
just look at man biff.
Bye
Andrea
krisanti_at_castore.sci.uniroma1.it
-----------------------------------------------------------------------------------------------
3 )
The DECtalk Software package includes an example utility to announce
incoming mail. It reads who the mail is from and the subject line. You
can also insert a WAV file (like a barking dog).
garrett
-- garrett.convergent.com
-----------------------------------------------------------------------------------------------
4 )
tkpostage is a biff like program (better IMHO) that has an option -beep,
that will beep to tell you new mail has arrived, and as it is writen in
Tk/tcl, it should be fairly easy to change it to run anything else that
you desire.
[ Part 2: "signature" ]
dwagon_at_aaii.oz.au
-----------------------------------------------------------------------------------------------
5 )
In your .forward, if you have a line like
| /your/home/dir/bin/mailbell
whenever mail is sent to you, it will run /usr/local/bin/mailbell with the
message sent to it's standard input. It will NOT save the mail in your
mailbox so your script will have to do this itself. Here is an example of
what to put in mailbell:
#!/bin/sh
me=`whoami`
# arrange for mail to be stored in your inbox and a temp. copy made in /tmp
# that will be removed when the script exits
tee /tmp/mesg.$$ >> /var/spool/mail/$me
trap "rm /tmp/mesg.$$" 0
for tty in `w -h $me | cur -f3 -d' '`
do
# commands you wanted to run for every terminal you are logged in
# should be put here. We simulate a biff here:
head -10 /tmp/mesg.$$ > /dev/tty$tty
done
# commands you want to be run once no matter if you're logged in or not
# can go here
echo -n "Respond to mail" >> /usr/users/$me/.plan
grep -i "^From:" /tmp/mesg.$$ >> /usr/users/$me.plan
Anyway, you can execute arbitrary commands when you get mail. These examples
just give you an idea of how flexible you can be. I haven't tested these
(or much of this at all) so you may have to expiriment.
Sean Watson <swatson_at_ultrix6.cs.csubak.edu>
-----------------------------------------------------------------------------------------------
6 )
If you look at your aliases file in /var/adm/sendmail/aliases, you
can add a line so that when your username receives mail it will be
fed into a script that you write. It should work with the following
line:
username: "|/enter/path/here/filename.ext"
That should do it for you.
Good luck!
Stuart Garner
Sr. Automation Engineer
STUARTMG_at_delphi.com
-----------------------------------------------------------------------------------------------
7 )
In your home directory, create a file name .forward with the following
contents:
\deya,|/home-dir-of/deya/bin/mymailprog
When a message comes in, one copy will go in the spool file, the other
will be given to the script as standard input.
Eric B.
Eric Bennett <bennett_at_hpel.umd.edu>
-----------------------------------------------------------------------------------------------
8 )
If it's a sound you're after, take a look at sxbiff -- a sound-based biffer
that can play different sounds based on regexp matches in the from, subject,
to lines, etc.
> I am running pine version 3.91 , I can use xbiff, but that doesn't do
> what I wnat .
Otherwise I suggest you write a program that looks at your
/var/spool/mail/<username> file once every second, and performs some action
when that file changes.
A good name for such a program might be "watch" -- since it watches for
changes on a particular file. For example:
watch /var/spool/mail/deya -- $HOME/bin/beep
(where $HOME/bin/beep might be something like
#!/bin/ksh
print -n '\07'
But the uses don't end there. Imagine, if you will, something like this:
watch *.tex -- latex main.tex
Just in case you don't want to write such a program, here's one that I
prepared earlier... Save it in watch.c and then compile it with
cc -o watch watch.c
Have fun!
Ian
Ian Piumarta <piumarta_at_prof.inria.fr>
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
--------------------------- E N D O F R E P L I E S ---------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
The best answer that did exactly what I wanted was from Iam Piumarta, Thanks Ian for all your help .
If any one is interested in the script that would watch any file for changes , ie. the mail file , let me
know and I will forward it to you . I am now using pine , with the watch script , and it works just fine .
My apologies if I missed any one who replied .
Deya
-------------------------------------------------------------------------
Deya Motawie Tel(O): (015) 414130
School Of Computing Science. Fax : (02) 5645341
UTS - Msc Researcher AI Lab. Email : Dhmotawi_at_Socs.uts.edu.au
University Of Technology, Sydney P.O. Box 123, Broadway NSW 2007
APANA System Administrator
(02 ) 692-0151 (Vox) Email : Deya_at_Pyramids.apana.org.au
-------------------------------------------------------------------------
Received on Fri Jan 26 1996 - 15:18:53 NZDT