From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id B50261381F3 for ; Wed, 12 Dec 2012 22:10:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0877E21C058; Wed, 12 Dec 2012 22:10:41 +0000 (UTC) Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com [74.125.83.53]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id F2ED721C031 for ; Wed, 12 Dec 2012 22:09:24 +0000 (UTC) Received: by mail-ee0-f53.google.com with SMTP id c50so881858eek.40 for ; Wed, 12 Dec 2012 14:09:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=8Iib1h5AcCkBZvihj68VL6Ebchf6jsABPswJXl5BLv8=; b=oo+r56FC6cjg6VDWAj/JVe08quUx9Gdsj8ma4pBfSupLlB6WPqLZmiwVegLL1n8vRf cQ+kx25vLGB9uD8kmmQJv1hss7ERHf8EwcJlI2sguew/sJL4YV0YTV4Lyw9wyXZEwN+M nr5nnAMAOsD+5JJBz/28CKFdRqeuSjcoZEw3laS/FKyACQK4ZHSk9IpQOew9YfA3d6y9 XwlODaa7FHfZ319WzV5uDQhOB7YYAIo5Q0qn6GJ2tIywu2B3l6pkt8yXppsTs1AxgvGZ jiX/N6VbdgHZb77BPCUbpBddIbjr1mRSox/Uu4PIAksEM8VWfBmUlFrufTFe9F8HY9TZ KU5g== Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.14.214.132 with SMTP id c4mr6418149eep.18.1355350163545; Wed, 12 Dec 2012 14:09:23 -0800 (PST) Received: by 10.223.158.68 with HTTP; Wed, 12 Dec 2012 14:09:23 -0800 (PST) In-Reply-To: <50C7F69B.6080100@orlitzky.com> References: <50C7F69B.6080100@orlitzky.com> Date: Wed, 12 Dec 2012 14:09:23 -0800 Message-ID: Subject: Re: [gentoo-user] crontab questions From: Grant To: Gentoo mailing list Content-Type: multipart/alternative; boundary=047d7b621df80b5d0b04d0af0d17 X-Archives-Salt: b2e5210a-e8ca-4d2e-ad41-c5e37331d0b8 X-Archives-Hash: 633a8ab472f7d6d39ad8095f20748adf --047d7b621df80b5d0b04d0af0d17 Content-Type: text/plain; charset=ISO-8859-1 > > Is there a way to remove "Cron " 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 --047d7b621df80b5d0b04d0af0d17 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable > > Is there a way to remove "Cron <root@hostname>" f= rom the subject line of
> > crontab mail without piping each cron = job to 'mail'?
> >
> > I set 'usermod -c host= name root' on each of my systems so that the From:
> > line displays "hostname" for crontab mail. =A0This work= s on each system
> > except the mail server itself which still sho= ws "Cron Daemon". =A0Can
> > crontab mail from the mail = server be made to display From: "hostname"
> > like the other systems?
> >
> > I'm not com= pletely clear on how cronbase works. =A0Can this crontab be
> > in= tegrated 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 dis= tfiles
> > 30 4 * * * eclean -C packages
> > 40 4 * * * eix-test-ob= solete
> > 45 4 * * * revdep-rebuild -ip
> >
>
&= gt; 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,
>> =A0 * /etc/cron.daily
> =A0 * /etc/cron.hourly
> =A0 * /e= tc/cron.monthly
> =A0 * /etc/cron.weekly
>
> at roughly the time specified i= n /etc/crontab. If any of those
> directories contain scripts, they&#= 39;re run in "alphabetical" order, i.e.
> how `ls` would so= rt them.

Thanks Michael. =A0I'd like to have more control over when the comm= ands are run. =A0Maybe the system crontab (cronbase) should be used when th= at control isn't necessary or to allow programs to add stuff to a cront= ab, and a user crontab should be used when more control is necessary?

> To fix the Subject/From headers, try,
>
> =A0 http://www.postfix.org/hea= der_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 wi= th
> something that executes e.g.,
>
> =A0 sed -e 's/= Subject: Cron <[^>]> /Subject: /g' | /the/actual/sendmail
>
> Both feel a little dirty, but the header checks are less likel= y to break
> something assuming that they will work on a client-provi= ded From header.

I think it's better for me to pipe the commands= to mailx. =A0I 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 th= e crontab. =A0Do you know why that's happening?=A0=A0I do get mail from= 'emerge -pvDuN world' run in the crontab without piping it to mail= .

- Grant
--047d7b621df80b5d0b04d0af0d17--