Send cronjob output to multiple email addresses.

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/

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

vi /etc/mail/aliases

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, 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:


That’s all.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: