Change cron default sendmail to mail

Asu

New Member


Messages: 1

I'm running FreeBSD 11.0-RELEASE.

On default cron is using /usr/lib/sendmail to send user emails. How can I tell/set cron to use /bin/mail instead?

crontab(5)() says in the section about the MAILTO var:
This option is useful if you decide on /bin/mail instead of /usr/lib/sendmail as your mailer when you install cron -- /bin/mail does not do aliasing, and UUCP usually does not read its mail.

I downloaded the FreeBSD source code and tried the command # make config in /usr/src/usr.sbin/cron/, that ofc does not work since config is not defined. But I think that's an bad idea anyway cause future updates could easy overwrite this?

Sorry for the noob question, I'm completely new to FreeBSD/Unix.
Thanks for your help!
 

Terry_Kennedy

Aspiring Daemon

Reaction score: 347
Messages: 979

I'm completely new to FreeBSD/Unix.
Welcome!
How can I tell/set cron to use /bin/mail instead?
It looks like this is configured in /usr/src/usr.sbin/cron/cron/config.h - search for MAILCMD. Note that the support for alternate mailers was probably in Vixie cron when it was imported (as opposed to added by FreeBSD) and the arguments in the defines may not apply to / work with FreeBSD. Opening a bug report requesting a way to specify the mailer to be used by cron(8) without recompiling might get somewhere.
I downloaded the FreeBSD source code and tried the command # make config in /usr/src/usr.sbin/cron/, that ofc does not work since config is not defined.
That's correct - # make config is used in ports. For the base system, options (other than kernel configuration) are generally set in make.conf(5).
But I think that's an bad idea anyway cause future updates could easy overwrite this?
That is correct - any non-default base system options will be overwritten by an update that replaces any files that you rebuilt. Normal freebsd-update(8) behavior is to only replace files that changed on the FreeBSD build system(s). An update from 11.0-Px to 11.0-Py (where x and y are two different patch numbers) probably won't replace /usr/sbin/cron. Going between versions, there's more of a chance that it will be replaced.

There are also a variety of alternative cron-type implementations in the ports tree. Note that not everything in that link is an actual cron implementation - the list is just packages that have "cron" in the name in the sysutils category.
 
Top