Disable the eMail Alert By Crontab Command On a Linux or Unix-like Systems

www.lau‮irutt‬.com
Disable the eMail Alert By Crontab Command On a Linux or Unix-like Systems

To disable the email alert generated by the crontab command on a Linux or Unix-like system, you can use the following steps:

  1. Edit the crontab file for the user whose email alerts you want to disable. Run the following command:
crontab -e
  1. Add the following line at the end of the crontab file:
MAILTO=""

This will prevent any email alerts from being sent by the crontab command.

  1. Save the file and exit the editor.

Alternatively, you can also specify the MAILTO variable at the beginning of each line in the crontab file to control whether an email alert should be sent for that particular cron job. For example:

MAILTO=""
0 0 * * * /path/to/command

This will prevent an email alert from being sent for the cron job that runs the /path/to/command command at midnight every day.

Keep in mind that the MAILTO variable only controls email alerts sent by the crontab command. If a command run by a cron job generates its own email alerts, you will need to modify the command or its configuration to disable those alerts.

Created Time:2017-10-28 14:02:28  Author:lautturi