Hi,
As always something new happend. Today I have time to explain how to disable the email alert that CRON send with the output of a command... and How to delete the emails from console?
First, to avoid reveiving the email alert I recoment to add at the end of every cron line
And what is that? Simple. Adding this piece of code at the end of the command we indicate the system to send the stdout and stderr to /dev/null. Another shorter way is
which has the same effect. If you want to learn more about how to redirect the stderr and stdout you can create a doof script like this (kk.sh):
and try different commands to figure out how it works. For example:
Now to finish this post... how to delete the emails from the console? Easy!.
Hope help!!
As always something new happend. Today I have time to explain how to disable the email alert that CRON send with the output of a command... and How to delete the emails from console?
First, to avoid reveiving the email alert I recoment to add at the end of every cron line
1 * * * * your_script_here > /dev/null 2>&1
And what is that? Simple. Adding this piece of code at the end of the command we indicate the system to send the stdout and stderr to /dev/null. Another shorter way is
1 * * * * your_script_here &> /dev/null
which has the same effect. If you want to learn more about how to redirect the stderr and stdout you can create a doof script like this (kk.sh):
#!/bin/bash
echo "This is stdout." >&1
echo "This ist stderr." >&2
and try different commands to figure out how it works. For example:
$ sh kk.sh 1>/dev/null
This ist stderr.
$ sh kk.sh 2>/dev/null
This is stdout.
$ sh kk.sh 2>&1 > /dev/null
This ist stderr.
Now to finish this post... how to delete the emails from the console? Easy!.
Mail version 8.1 6/6/93. Type ? for help.
"/var/mail/texnological": 9458 messages 8543 unread
? delete 1-9458
? q
Hope help!!