Date: Mon, 31 Aug 2015 15:26:00 +0300 From: =?UTF-8?B?0KDRg9GB0LvQsNC9INCR0YPRgNGF0LDQvdC+0LI=?= <r100500b@gmail.com> To: Ernie Luzar <luzar722@gmail.com> Cc: freebsd-questions <freebsd-questions@freebsd.org> Subject: Re: how to change daily cron emails to go to user account instead of root Message-ID: <CAGzH003c6dQUt48mTC3cXtqVXZF-334qwgU_obzF=StaPDkNEw@mail.gmail.com> In-Reply-To: <55E2FDFA.7090301@qeng-ho.org> References: <55DF057F.6040205@gmail.com> <55DF0C75.5000907@qeng-ho.org> <55DF0DB3.3040400@qeng-ho.org> <CAGzH002f-YFRMKweeBMvcLvkx1oxnsNMHTNPRJ%2B8rSCz4kxHBg@mail.gmail.com> <55E2F727.2040804@gmail.com> <55E2FDFA.7090301@qeng-ho.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <freebsd@qeng-ho.org>: > 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 <mailto: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 >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGzH003c6dQUt48mTC3cXtqVXZF-334qwgU_obzF=StaPDkNEw>