Ubuntu does in fact have this cron job already (check
/etc/cron.daily/mdadm). Ubuntu also installs anacron by default, so the job will be run once a day even if you shut down your computer at night.
When a cron job produces output, it is sent to the local mailbox of the user running the crontab (here, the system administrator account,
Unfortunately, Ubuntu does not set anything up for users to receive and read local mail. So you need to do several things:
- Make sure your machine runs a mail transfer agent such as postfix.
Have root's mail forwarded to your account. All the system cron jobs run as root. With postfix, edit the file
/etc/aliases and add a line like
to forward root's mail to your local mail account.
If you want your local email to be forwarded to an online account, create a file called
.forward in your home directory containing your address, e.g. with the command
echo firstname.lastname@example.org >~/.forward
If you want to read your local mail, set up your mail reader program for that.
See How are administrators supposed to read root's mail? for more detailed and up-to-date instructions on reading local administrator mail.