No longer need to run m4 to rebuild sendmail.cf under CentOS 7

When I was running Sendmail on a CentOS 5 server, I needed to use the m4 command after modifying /etc/sendmail.mc to rebuild /etc/sendmail.cf from that file, i.e., m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf. E.g., see Configuring Sendmail to Use a Smart Host, but that is no longer needed with CentOS 7 and, though I went from CentOS 5 to 7, may have gone away as a needed step in CentOS 6. Now, if you modify /etc/sendmail.mc, when you restart sendmail, e.g., with service sendmail restart, the sendmail.cf file is automatically rebuilt.

If you issue the command service sendmail restart, you will see Redirecting to /bin/systemctl restart sendmail.service.

# service sendmail restart
Redirecting to /bin/systemctl restart  sendmail.service
#

If you examine /usr/lib/systemd/system/sendmail.service, you will see that the make command, i.e., /etc/mail/make, is run.

# locate sendmail.service
/etc/systemd/system/multi-user.target.wants/sendmail.service
/usr/lib/systemd/system/sendmail.service
# cat /usr/lib/systemd/system/sendmail.service
[Unit]
Description=Sendmail Mail Transport Agent
After=syslog.target network.target
Conflicts=postfix.service exim.service
Wants=sm-client.service

[Service]
Type=forking
PIDFile=/run/sendmail.pid
Environment=SENDMAIL_OPTS=-q1h
EnvironmentFile=-/etc/sysconfig/sendmail
ExecStartPre=-/etc/mail/make
ExecStartPre=-/etc/mail/make aliases
ExecStart=/usr/sbin/sendmail -bd $SENDMAIL_OPTS $SENDMAIL_OPTARG

[Install]
WantedBy=multi-user.target
Also=sm-client.service
#

You can also verify that sendmail.cf is recreated when you restart Sendmail by modifying sendmail.mc and then restarting Sendmail as shown below:

# ls -l /etc/mail/sendmail.??
-rw-r--r--. 1 root root 61060 Sep  2 19:44 /etc/mail/sendmail.cf
-rw-r--r--. 1 root root  8226 Sep  2 20:03 /etc/mail/sendmail.mc
[root@moonpoint bin]# service sendmail restart
Redirecting to /bin/systemctl restart  sendmail.service
[root@moonpoint bin]# ls -l /etc/mail/sendmail.??
-rw-r--r--. 1 root root 60494 Sep  2 20:03 /etc/mail/sendmail.cf
-rw-r--r--. 1 root root  8226 Sep  2 20:03 /etc/mail/sendmail.mc
#

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px