public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Grant <emailgrant@gmail.com>
To: Gentoo mailing list <gentoo-user@lists.gentoo.org>
Subject: Re: [gentoo-user] crontab questions
Date: Wed, 12 Dec 2012 14:09:23 -0800	[thread overview]
Message-ID: <CAN0CFw2nYcPpC-uFh7irZky11ObcGYRBzEYNrFVLFecX_xzx7Q@mail.gmail.com> (raw)
In-Reply-To: <50C7F69B.6080100@orlitzky.com>

[-- Attachment #1: Type: text/plain, Size: 2507 bytes --]

> > Is there a way to remove "Cron <root@hostname>" from the subject line of
> > crontab mail without piping each cron job to 'mail'?
> >
> > I set 'usermod -c hostname root' on each of my systems so that the From:
> > line displays "hostname" for crontab mail.  This works on each system
> > except the mail server itself which still shows "Cron Daemon".  Can
> > crontab mail from the mail server be made to display From: "hostname"
> > like the other systems?
> >
> > I'm not completely clear on how cronbase works.  Can this crontab be
> > integrated into the system crontab via cronbase or should it be run as a
> > separate user crontab for root?
> >
> > 0 4 * * * layman -NS && eix-sync -n && eix-remote update -n
> > 15 4 * * * emerge -pvDuN world
> > 20 4 * * * eclean -C distfiles
> > 30 4 * * * eclean -C packages
> > 40 4 * * * eix-test-obsolete
> > 45 4 * * * revdep-rebuild -ip
> >
>
> If your goal is to run these each one after the other, you can simply
> stick a shell script in /etc/cron.daily that executes them in order.
>
> The default crontab runs any executable files in,
>
>   * /etc/cron.daily
>   * /etc/cron.hourly
>   * /etc/cron.monthly
>   * /etc/cron.weekly
>
> at roughly the time specified in /etc/crontab. If any of those
> directories contain scripts, they're run in "alphabetical" order, i.e.
> how `ls` would sort them.

Thanks Michael.  I'd like to have more control over when the commands are
run.  Maybe the system crontab (cronbase) should be used when that control
isn't necessary or to allow programs to add stuff to a crontab, and a user
crontab should be used when more control is necessary?

> To fix the Subject/From headers, try,
>
>   http://www.postfix.org/header_checks.5.html
>
> I've never had to use them myself, but I think the REPLACE action will
> do what you want. The alternative is to replace the sendmail binary with
> something that executes e.g.,
>
>   sed -e 's/Subject: Cron <[^>]> /Subject: /g' | /the/actual/sendmail
>
> Both feel a little dirty, but the header checks are less likely to break
> something assuming that they will work on a client-provided From header.

I think it's better for me to pipe the commands to mailx.  I get mail if I
run this on the command line

emerge -pvDuN world | /usr/bin/mail -s "subject" -a "From: from"
my@email.com

But I don't get any mail when it runs in the crontab.  Do you know why
that's happening?  I do get mail from 'emerge -pvDuN world' run in the
crontab without piping it to mail.

- Grant

[-- Attachment #2: Type: text/html, Size: 3213 bytes --]

  reply	other threads:[~2012-12-12 22:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-11 21:15 [gentoo-user] crontab questions Grant
2012-12-12  3:14 ` Michael Orlitzky
2012-12-12 22:09   ` Grant [this message]
2012-12-13  1:01     ` Michael Orlitzky
2012-12-15  2:36       ` Grant
2012-12-15 17:21         ` Michael Orlitzky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAN0CFw2nYcPpC-uFh7irZky11ObcGYRBzEYNrFVLFecX_xzx7Q@mail.gmail.com \
    --to=emailgrant@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox