How to remove the notification of the cron

From EN Ikoula wiki
⧼vector-jumptonavigation⧽ ⧼vector-jumptosearch⧽

en:How to remove the notification of the cron he:כיצד להסיר את ההודעה של cron ro:Cum la spre remove notificării cron ru:Как удалить уведомления о cron pl:Jak usunąć powiadomienia o cron ja:どのように cron の通知を削除するには ar:كيفية إزالة الإخطار كرون zh:如何删除 cron 的通知 de:Die Benachrichtigung über die Cron entfernen nl:Hoe te verwijderen van de kennisgeving van de cron it:Come rimuovere la notifica di cron pt:Como remover a notificação de cron es:Cómo quitar la notificación de la cron fr:Comment supprimer les notification des tâches CRON

This article has been created by an automatic translation software. You can view the article source here.

Introduction

By default, to the achievement of a task to the crontab, Cron sends an email notification to the user in question containing the complete output of the executed script.
For some use, this notification is important because it allows to know if the shares are passed correctly.
However, in other cases, it can be annoying, especially if the tasks are carried out over short periods and therefore sending emails in bursts.

The deletion of the notification for a particular task

To prevent a particular task to send an e-mail, just add a directive asking him to redirect the output to nothing at the end of the command (/dev/null), it is possible to achieve two ways :

  • by adding > /dev/null 2>&1 at the end of the command,
  • by adding &> /dev/null at the end of the command.


The result for these two cases is the same, you will not receive more mail notification regarding this task.
Here is a complete example :

59 23 * * * root /home/backup/backup.cmd &> /dev/null

Or :

59 23 * * * root /home/backup/backup.cmd > /dev/null 2>&1

Deleting complete notifications for a user

To completely remove the notifications by mail for a user, simply use the MAILTO variable in the crontab.
At the beginning of the crontab file (before the definition of the tasks ), so just add the line :

MAILTO=""

It is also possible to use this variable to send notifications on a different email than account, current user's local.
To do this it is sufficient to indicate a specific email :

MAILTO="utilisateur@domaine.tld"



This article seemed you to be useful ?

0



You are not allowed to post comments.