A crontab file contains instructions to the cron daemon. It wakes up every minute, examining all stored crontabs, checking each command to see if it should be run in the current minute. When executing commands, any output is mailed to the owner of the crontab or to the user named in the MAILTO environment variable in the crontab, if such exists. The syntax is:
name = value
Where the spaces around the equal-sign (=) are optional, and any subsequent non-leading spaces in value will be part of the value assigned to name. The value string may be placed in quotes (single or double, but matching) to preserve leading or trailing blanks. The value string is not parsed for environmental substitutions, thus lines like:
PATH = $HOME/bin:$PATH
will not work as you might expect.
In addition to LOGNAME, HOME, and SHELL, cron will look at MAILTO if it has any reason to send mail as a result of running commands in “this” crontab. If MAILTO is defined (and non-empty), mail is sent to the user so named. First open your crontab file:
# vi /etc/crontab
$ crontab -e
To send email to [email protected], enter:
If MAILTO is defined but empty (MAILTO=””), no mail will be sent.
Otherwise mail is sent to the owner of the crontab.
- What is cron on a Linux or Unix-like systems?
- HowTo: Add Jobs To cron Under Linux or UNIX?
- Linux Verify crond Daemon And Cronjobs Are Running
- Linux Start Restart and Stop The Cron or Crond Service
- Linux: List / Display All Cron Jobs
- Linux / UNIX Crontab File Location
- Linux / UNIX: Change Crontab Email Settings ( MAILTO )
- Disable The Mail Alert By Crontab Command On a Linux or Unix-like Systems
- Linux: At What Time Cron Entries In cron.daily, cron.weekly, cron.monthly Run?
- Linux Execute Cron Job After System Reboot
- Linux / UNIX Setup and Run PHP Script As A Cron Job
- How to run crontab job every minute on a Linux or Unix-like system
- Run crontab (cron jobs) Every 10 Minutes
- Cron Job Script Execution on the Last Day of a Month