From owner-freebsd-questions@freebsd.org Mon Aug 31 12:26:03 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46E4C9C63A1 for ; Mon, 31 Aug 2015 12:26:03 +0000 (UTC) (envelope-from r100500b@gmail.com) Received: from mail-lb0-x22b.google.com (mail-lb0-x22b.google.com [IPv6:2a00:1450:4010:c04::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C10B1116 for ; Mon, 31 Aug 2015 12:26:02 +0000 (UTC) (envelope-from r100500b@gmail.com) Received: by lbbtg9 with SMTP id tg9so59417213lbb.1 for ; Mon, 31 Aug 2015 05:26:01 -0700 (PDT) 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 :cc:content-type; bh=hA3fjEO605CGUf79Ecg+eU9s+peGSmNB8IxBA4fp4ls=; b=xFr6rPuZj5P/O+achY5SA0Iep4wB8OPfENH1jsOIQei+LKleg5KYST+huMSF8NWVkz ZF3BowVOCkRZIeUYM1apGPifY4Dcn4L4cJI7DaEp5OmnBsdDUxvutM0sWyGB9a0J9mMj ObvZ2iKP+ZHv9tnIREve7x6TBT9ZptvRJKQBk2QTSGM9F5Msuga2ye2G7WxoM9CtISZE AOWle9FenmHltw83JsKtWZz0jVD0yKYD9sjnOAeXOHmdCOoiWuL5poo9dIBIwV9Kmrz5 9rp3CgwjKZZrQX/xPIlzflEgQKqzjGztf/r4P+fier1z+MDy0Yel1oRjPW+XqdZAd98o XXMQ== MIME-Version: 1.0 X-Received: by 10.152.6.162 with SMTP id c2mr5414592laa.1.1441023960897; Mon, 31 Aug 2015 05:26:00 -0700 (PDT) Received: by 10.112.55.9 with HTTP; Mon, 31 Aug 2015 05:26:00 -0700 (PDT) In-Reply-To: <55E2FDFA.7090301@qeng-ho.org> References: <55DF057F.6040205@gmail.com> <55DF0C75.5000907@qeng-ho.org> <55DF0DB3.3040400@qeng-ho.org> <55E2F727.2040804@gmail.com> <55E2FDFA.7090301@qeng-ho.org> Date: Mon, 31 Aug 2015 15:26:00 +0300 Message-ID: Subject: Re: how to change daily cron emails to go to user account instead of root From: =?UTF-8?B?0KDRg9GB0LvQsNC9INCR0YPRgNGF0LDQvdC+0LI=?= To: Ernie Luzar Cc: freebsd-questions Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Aug 2015 12:26:03 -0000 Ernie, look: Open you rc.conf, copy string and modify flags for cron daemon: cron_flags=3D"-j 60 -m 'YOU@MAIL'" Then, restart cron daemon (it is not necessary reboot system): /etc/rc.d/cron restart Then take a look on cron process: ps auxww | grep cron If you doing all okey, it will be something like: root 561 0.0 0.1 7984 1528 ?? Is 3:16PM 0:00.01 /usr/sbin/cron -j 60 -m YOU@MAIL -s 2015-08-30 15:58 GMT+03:00 Arthur Chance : > On 30/08/2015 13:29, Ernie Luzar wrote: > >> =D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD =D0=91=D1=83=D1=80=D1=85=D0=B0=D0= =BD=D0=BE=D0=B2 wrote: >> >>> man cron >>> >>> -m mailto >>> Overrides the default recipient for cron mail. Each >>> crontab(5) >>> without MAILTO explicitly set will send mail to the >>> mailto mail=E2=80=90 >>> box. Sending mail will be disabled by default if mailto >>> set to a >>> null string, usually specified in a shell as '' or "". >>> >>> So you just can add this option on cron flags from rc.conf, like: >>> >>> cron_flags=3D"-m 'root@mymail.com '" >>> >>> and restart cron daemon. >>> >> snip >> >> This method seemed the simplest so I gave it a try. >> The host has a user account called bob. I want all cron email to go to >> bob and not root. >> I use postfix and sendmail is disabled. >> >> I put cron_flags=3D"-m bob" in /etc/rc.conf and rebooted the host. >> Next morning the daily cron email still went to root. >> >> 1. Is there a way to scan rc.conf to verify all the included options are >> valid and accepted? >> 2. Since root and bob are on the same host is @mydomain really required? >> 3. Any ideas why it did not work and no errors were generated? >> > > The periodic script does its own output using this: > > output_pipe() > { > # Where's our output going ? > eval output=3D\$${1##*/}_output > case "$output" in > /*) pipe=3D"cat >>$output";; > "") pipe=3Dcat;; > *) pipe=3D"mail -E -s '$host ${2}${2:+ }${1##*/} run output' $output= ";; > esac > eval $pipe > } > > You need to override the various *_output variables periodic uses in > /etc/periodic.conf. See my earlier mail on the subject. > > -- > Those who do not learn from computing history are doomed to > GOTO 1 >