1835215 Members
2557 Online
110078 Solutions
New Discussion

Scripting help needed

 
SOLVED
Go to solution
Wim Rombauts
Honored Contributor

Scripting help needed

If possible, I want to write a script that will be started as soon as a mail arrives in a certain mailbox (standard SMTP mailbox from HP-UX) on my system.

If that is not possible, maybe I could start a script that sleeps until a mail arrives in a specific mailbox, performs some tasks and then go to sleep again until a new mail arrives ?

Can someone give me some tips on how to do this ?
Thanks in advance.
6 REPLIES 6
Massimo Bianchi
Honored Contributor

Re: Scripting help needed

Hi,
mi hint:
use the command "mailx -e" every tot minutes to test if there is new mail, and take action.

If you want to use the header for more info:

-H Print header summary only.

-L Print complete header information only.


Or check "man mailx" for other options.

HTH,
Massimo

RolandH
Honored Contributor
Solution

Re: Scripting help needed

If you are working with sendmail on your box, then you can do this with a simple trick.

go into

# cd /etc/mail
# vi aliases

i.e. your email account is wim.
create a line

wim: "| "

save it !!!

/usr/sbin/newaliases

Now, everytime wim gets an email. will be started.


Regards

Roland

PS: Read manpage from aliases

Sometimes you lose and sometimes the others win
Massimo Bianchi
Honored Contributor

Re: Scripting help needed

Hi,
another hint.

You can create a .forward in your home dir.

I remember that there are tricks that can let you run every program you need at every mail that arrives...

Massimo

Massimo Bianchi
Honored Contributor

Re: Scripting help needed

Hi,

in this link !!!

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xee00d311e18ad5118ff10090279cd0f9,00.html



THer must be a .forward like this:


| yoursctipto execute

in a line.

Game is done, i think.
Massimo
Wim Rombauts
Honored Contributor

Re: Scripting help needed

Roland,

This is great ! This is exactly what I was looking for. Thank you very much !