Amanda-Users

Re: Amanda not sending emails

2003-10-03 13:57:32
Subject: Re: Amanda not sending emails
From: Eric Siegerman <erics AT telepres DOT com>
To: amanda-users AT amanda DOT org
Date: Fri, 3 Oct 2003 13:44:57 -0400
On Fri, Oct 03, 2003 at 11:22:45AM -0400, M3 Freak wrote:
> Amanda is using "mail", and it works fine (just sent a test message
> using "mail").  Here's what I got when I typed in what you suggested: 
> 
> UNCOMPRESS_PATH="/usr/bin/gzip" MAILER="/usr/bin/Mail"

Note that sometimes "mail" and "Mail" are *not* (symlinks to) the
same program, so don't assume that they behave identically.

<history>
At some point in the distant past (at Berkeley, I believe),
someone came up with a spiffy new mail client (which we'd now
consider as awesome as, say, a 486 :-)  For backward
compatibility, they couldn't call it "mail", since that was the
name of the old(er), ugly(er) client.  Instead they picked a
stupid name, "Mail", and for compatibility with *them*, we've had
to live with that ever since (though Mail is sometimes known as
"mailx" instead.)
</history>


> 02 4 * * * root run-parts /etc/cron.daily
> [...]
> Should I create a new file called, for example,
> "amanda.cron" under "/etc/cron.daily" instead of placing the cron entry
> for amanda in "/etc/crontab"?

NO!  Or rather, only if you want your amdump and amcheck to run:
  - as root -- which you don't, since they want to run as the
    amanda user (i.e. the value you gave for the --with-user=
    option to configure).  And for security reasons, that user
    should *not* be root!

  - at 4:20 AM, which is quite possibly too late for amdump, and
    is almost certainly too late for "amcheck -m" :-)

Either make separate entries in /etc/crontab, or use "crontab -e"
to create a crontab for the amanda user.  As far as I can tell,
the two methods are identical.  (The only difference is that the
user themselves can use "crontab -e", but only root can edit
/etc/crontab.  For the amanda user, that's probably irrelevent.)


On Fri, Oct 03, 2003 at 12:29:06PM -0400, Jon LaBadie wrote:
> On Fri, Oct 03, 2003 at 11:22:45AM -0400, M3 Freak wrote:
> > [in crontab]
> > MAILTO=root
> 
> The parameter in the amanda.conf file "mailto" (lowercase) is
> set correctly isn't it?
> 
> But the uppercase form does appear in the source code.  I don't know
> if it might pick this up from the environment.

Doesn't look that way.  The only place MAILTO occurs (in the
2.4.4 source tree) is in server-src/conffile.c, where it's (a) an
enum constant, and (b) a string that's used to (case-insensitively)
match tokens from amanda.conf.  I think that the MAILTO
environment variable is a red herring.

However, it might be useful in tracking down the real problem.
What MAILTO in a crontab does is to tell cron where to email the
program's stdout and stderr, if there is any -- but of course
there isn't from "amcheck -m", since that mails its report
instead.

But what if amcheck is dying before it sends the email?  Like,
because it's being run as root instead of the amanda user
perhaps...

Try removing the "-m", and setting MAILTO properly in the
crontab, if it isn't already.  Then "amcheck" will write its
report to stdout, and cron will mail you the results.  That way,
if amcheck is aborting early, you'll see the messages.

Also check the mail logs, as others have suggested; and the cron
logs too (they're in /var/log, or /var/cron, or /var/spool/cron,
or somewhere like that).  Either of those might tell you
something useful.

--

|  | /\
|-_|/  >   Eric Siegerman, Toronto, Ont.        erics AT telepres DOT com
|  |  /
When I came back around from the dark side, there in front of me would
be the landing area where the crew was, and the Earth, all in the view
of my window. I couldn't help but think that there in front of me was
all of humanity, except me.
        - Michael Collins, Apollo 11 Command Module Pilot