Wednesday, May 31, 2023
Centos Crontab

cron send alert to email

Specify Email for Each Script

If we don’t want all output to go to the same email address we can specify the output of a particular script to go to a different email address:

59 */6 * * * script.sh | mail -s "Subject of Mail" someother@address.com 

Email Alerts for All but One

If you have a specific script in your crontab that you don’t want output or errors emailed to you, simply add, ‘>/dev/null 2>&1’ to the end of the command.

59 */6 * * * script.sh >/dev/null 2>&1 
(Visited 21 times, 1 visits today)
Baca Juga :  How to Clear RAM Memory Cache, Buffer and Swap Space on Linux

Similar Posts