[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SOLVED] Re: crontab mails to external smtp host



On Sun, 2011-09-18 at 15:17 -0600, Bob Proulx wrote: 
> Steven wrote:
> > I manage several Debian servers (etch and squeeze), not related to one
> > another, and they all have some crontab jobs scheduled such as backup
> > scripts. When these cronjobs are run, the output is e-mailed to the
> > local admin account on the system. Is it possible to configure these
> > e-mails to be delivered to an external address over an external SMTP
> > server instead of locally?
> 
> You can set up an alias for root in /etc/aliases to point to another
> host.  Then all email to root will forward to the other address.
> 
>   root: root@other.example.com
> 
> Normally after changing the aliases file you need to run 'newaliases'
> to rebuild the cache file.  But I think exim does not need this.
> 
> Alternatively if you only want to change the crontab output and
> nothing else then Vixie Cron (the default for most GNU/Linux distros)
> enables you to set the MAILTO variable.  If your system has a default
> install of exim then very likely you can simply set the address.  Put
> this in your crontab file and it will only affect that particular
> crontab.
> 
>   MAILTO = "root@other.example.com"

Unfortunately both of these solutions don't work with my default exim
config, as that won't allow you to send to external addresses. The exim
config would need to be changed anyway.

> 
> > All systems where I would want to do this run Squeeze and use exim4 in a
> > default configuration as none of them are e-mail servers.
> 
> But of course exim4 in a default configuration is an email server even
> if you are not thinking of it that way.
> 
> The other suggestion to use nullmailer to simplify the MTA seems
> reasonable to me.  I always use nullmailer for chroots.

I have no experience with nullmailer whatsoever (but none with exim
either), but as it's a separate package I needed to install, and would
need to lookup the config, I figured Juan's exim solution would be the
easiest for me.

> 
> The other suggestion to reconfigure exim to use a smarthost is
> reasonable too.  But I think probably more complicated than you need
> to do for what you are asking.

It does the job for me, and isn't terribly complicated, Juan explained
it exactly as needed.

> 
> Bob

Thanks everyone for helping me out on this one.
Kind regards,
Steven

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: