views:

46

answers:

2

Hi, I'm new to openSuse 11.1, I have several crontab jobs running, one of which creates a dynamic list of 'at' jobs each day. Is there a way for the emails which the 'sh' shell sends to /var/usr/email/dave to be forwarded to other email addresses, my research has come up blank, mainly because I'm not sure what I'm looking for. Cheers if anyone can help.

Since looking into this, when printing from perl after script executed in /bin/sh shell, /bin/sh emails the printout to /var/usr/mail/dave, I would like to simple forward this email to other pop3 accounts, one of which is accessible by my phone. My apologies my original question wasn't clear enough

+1  A: 

Set the MAILTO environment variable in the crontab file to the name of the user you'd like to receive the mail. Add it if it's not there.

From man 5 crontab:

       In addition to LOGNAME, HOME, and SHELL, cron(8) will look at MAILTO if
       it  has  any  reason  to  send  mail as a result of running commands in
       ``this'' crontab.  If MAILTO is defined (and non-empty), mail  is  sent
       to the user so named.  MAILTO may also be used to direct mail to multi‐
       ple recipients by separating recipient users with a comma. If MAILTO is
       defined but empty (MAILTO=""), no mail will be sent.  Otherwise mail is
       sent to the owner of the crontab.
Dennis Williamson
Hi Dennis, :-) thanks for the quick response, will your solution also take care of any output from the 'at' jobs as well? When I ran tests I flipped out at how easy it was to get errors from perl in my inbox, then thought if i could get them forwarded to my phone, I could respond to problems very quickly. Cheers
wizball
You could probably use procmail. http://www.procmail.org/
Dennis Williamson
Cheers will look into this.
wizball
A: 

If you want to forward all of dave's mail, see if a simple .forward file works.

If you want to be selective about it, investigate procmail.

glenn jackman
cheers Glenn all information is greatfuly recieved, while i love linux, it is a beast of an os to learn.
wizball