From owner-freebsd-questions@freebsd.org Sun Aug 30 12:58:44 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 02FF59C68F1 for ; Sun, 30 Aug 2015 12:58:44 +0000 (UTC) (envelope-from freebsd@qeng-ho.org) Received: from bede.qeng-ho.org (bede.qeng-ho.org [217.155.128.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "fileserver.home.qeng-ho.org", Issuer "fileserver.home.qeng-ho.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 9A8A690B for ; Sun, 30 Aug 2015 12:58:43 +0000 (UTC) (envelope-from freebsd@qeng-ho.org) Received: from arthur.home.qeng-ho.org (arthur.home.qeng-ho.org [172.23.1.2]) by bede.home.qeng-ho.org (8.15.2/8.15.2) with ESMTP id t7UCwY6m026662; Sun, 30 Aug 2015 13:58:35 +0100 (BST) (envelope-from freebsd@qeng-ho.org) Subject: Re: how to change daily cron emails to go to user account instead of root To: Ernie Luzar , =?UTF-8?B?0KDRg9GB0LvQsNC9INCR0YPRgNGF?= =?UTF-8?B?0LDQvdC+0LI=?= References: <55DF057F.6040205@gmail.com> <55DF0C75.5000907@qeng-ho.org> <55DF0DB3.3040400@qeng-ho.org> <55E2F727.2040804@gmail.com> Cc: freebsd-questions From: Arthur Chance Message-ID: <55E2FDFA.7090301@qeng-ho.org> Date: Sun, 30 Aug 2015 13:58:34 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <55E2F727.2040804@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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: Sun, 30 Aug 2015 12:58:44 -0000 On 30/08/2015 13:29, Ernie Luzar wrote: > Руслан Бурханов 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‐ >> 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="-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="-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=\$${1##*/}_output case "$output" in /*) pipe="cat >>$output";; "") pipe=cat;; *) pipe="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