> Date: Sat, 2 Aug 2014 21:10:16 +0100
> From: Ken Moffat <[email protected]>
> To: BLFS Development List <[email protected]>
> Subject: Re: [blfs-dev] /etc/logrotate.conf nomail option
>
> On Sat, Aug 02, 2014 at 08:27:02AM +0100, akhiezer wrote:
> > > Date: Sat, 2 Aug 2014 00:54:07 +0100
> > > From: Ken Moffat <[email protected]>
> > > To: [email protected]
> > > Subject: [blfs-dev] /etc/logrotate.conf nomail option
> > >
> > >  I'm just updating my build scripts.  For years I have used a simple
> > > script to do log rotation, so now I am going to try the logrotate
> > > package.  Looking at the creation of /etc/logrotate.conf we have the
> > > following:
> > >
> > > # Don't send mail to anybody
> > > nomail
> > >
> > >  I read that comment as "logrotate should not send mail about its
> > > operation to anybody", which is not necessarily what I want
> > > (although I think I'm going to get a report from fcron).  But looking
> > > at an online manpage, and the link to techrepublic.com, the command
> > > appears to mean "Do not mail old logs (which are about to be deleted)
> > > to anybody" and that is proobably what I want.
> > >
> > >  Am I right that the comment is misleading, or have I misunderstood
> > > it ?
> > >
> > 
> > 
> > What behaviour _do_ you want?
> > 
>  Just confirmation that the program has run.


Here, we have e.g. (for 'dcron'):
====
$ cat /etc/cron.daily/logrotate
#!/bin/sh
/usr/sbin/logrotate /etc/logrotate.conf
[ $? != 0 ] && /usr/bin/logger -t logrotate "ALERT - exited abnormally."
$

$ crontab -l
        .
        .
__cron-ts-spec__ /usr/bin/run-parts /etc/cron.daily 1> /dev/null
        .
        .
$

====
You can of course adjust the output stuff re what you want cron to mail;
e.g remove/adjust the '1> /dev/null', and have '/etc/cron.daily/logrotate'
echo something on successful finish.


> > 
> > 'nomail' means the opposite sense of the 'mail' directive (ref excerpt
> > from man-page, below).
> > 
> > 
> > Here, for example, we'd normally use, in /etc/logrotate.conf , as
> > belts'n'braces additional backup for logfiles:
> > ----
> > mail eml_addr_userpart@eml_addr_dompart
> > maillast
> > ----
> > If instead I wanted to nail-down logrotate to not send email at all for
> > either of the 'mailfirst' or 'maillast' senses, then I'd use 'nomail'
> > by itself.
> > 
> > 
> > Note that logrotate can have nested, hierarchical definitions/contexts
> > in the cfg file, with deeper-nested definitions taking precedence: so you
> > can use e.g. 'nomail' globally, but override it for a sub-section.
> > 
> > 
> > The mail/nomail settings for logrotate, don't affect the usual
> > cron emailed reports. Although, you _could_ use logrotate's
> > p{re,ost}rotate/{fir,la}staction/&c directives, to mess about with such
> > cron stuff if you wanted, for whatever reason.
> > 
>
>  Thanks for that - very informative.
>
> > 
> > Ref: As da man says:
> > ----
> > mail address
> >   When  a  log  is  rotated  out-of-existence, it is mailed to address. If
> >   no mail should be generated by a particular log, the nomail directive
> >   may be used.
> > 
> > mailfirst
> >   When using the mail command, mail the just-rotated file, instead of the
> >   about-to-expire file.
> > 
> > maillast
> >   When using the mail command, mail the about-to-expire file, instead of
> >   the just-rotated file (this is the default).
> > 
> > nomail
> >   Don't mail old log files to any address.
> > 
> > ----
>
>  And it is that last line which makes me think the comment "Don't
> send mail to anybody" is misleading.  I'm just trying to increase
> clarity and reduce possible confusion.
>


_Logrotate_ itself won't initiate any 'please send mail' stuff if 'nomail'
is set (for the relevant context): but it doesn't - unless you're doing
something quite ~convoluted via the aforenoted pre/post/first/last directives
- stop e.g. a parent/calling-process such as cron from sending a usual-style
cron email reporting on the process (if logrotate has been called from cron).



hth,
akh





--
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to