Send cronjob output to multiple email addresses.
August 18, 2011
Posted by on
By default, cronjob will send the output of the command to the owner’s system mail box. In Linux, you can route the mail using
* * * * * /some/command.sh
in the crontab.
Some how, if I did that in Solaris, I got the following error:
crontab: error on previous line; unexpected character found in line.
crontab: errors detected in input, no crontab file generated.
So, I have to use mail aliases. First, I’ll have to edit the file
Assume the cronjob owner is called user1 and I need to leave the cronjob result in the owner’s inbox, forward a copy to user2 and another copy to an external email address firstname.lastname@example.org, I’ll add the following lines to the end of the file.
Then, I’ll refresh the mail system’s alias database with the following command: