Sendmail Configuration Basics

Sendmail configuration should be done in the /etc/mail/sendmail.mc file

To generate configuration changes, use the m4 macro processor:

<code>
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
</code>

To restart sendmail after making changes:

<code>
/etc/init.d/sendmail restart
</code>

Define the domainnames for which your mail server handles mail for in the /etc/mail/local-host-names file. For example, if you handle mail for example-abc.com, add this to the local-host-names file.
Restart sendmail after you make changes to this file.

Runlevels

Linux uses ‘runlevels’ to define the current capability of the system, for example, whether the system is running in single user, multi-user, text or graphical modes.

The default runlevel for when the system boots is defined in the file.

Edit this file and look for a line like this:

id:3:initdefault:

- the number specifies the default runlevel.

Valid runlevels are:

  • 0 - Halt the system
  • 1 - Single-user mode
  • 2 - Multi-user mode (without NFS)
  • 3 - Multi-user mode
  • 5 - Multi-user mode, graphical login
  • 6 - Reboot the system

The runlevel can be changed at run time using the init RUNLEVEL where RUNLEVEL is the runlevel you wnat to change to.

Automating recurring tasks with Cron

Setup a crontab file which defines whe the task should run:

m h d M D /script

where:

m minute: 0-59
h hour: 0-23
d day of the month: 1-31
M month of the year: 1-12
D day of the week, Sunday-0, 0-6
/script the script to execute

Values that are not relevant can be replaced with a ‘*” character.

Examples:

Run scriptA at 1:00 am:


* 1 * * * /scriptA

Run scriptB at every 15 minutes past the hour:


15 * * * * /scriptB

Run scriptC on the hour and every 30 minutes past the hour:


0,30 * * * * /scriptC

Run scriptD at 10,11 and 12, every Monday:


* 10-12 * * 1 /scriptC

To install the crontab setings, run:


crontab filename

To list the current crontab settings:


crontab -l