0

I have a cronjob setup using crontab that looks like this...

[email protected]
00 02 * * * /home/myaccount/myscript.sh

This works great and at 2AM it runs the script and emails me the output to [email protected]

The only issue is that the email subject and the name of the sender aren't very useful.

Is there a way to change them in the same way i can set the recipient email address?

Can I suppress the automatic email and pipe the output to mail myself?

1 Answer 1

4

Cron doesn't allow for a lot of configuration, but you can do this, assuming you have the mailutils package installed:

00 02 * * * /home/myaccount/myscript.sh 2>&1 | mail -s "My subject" $MAILTO

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .