- To: "Kevin Fitzgerald" <lists@xxxxxxxxxxxxxx>
- Subject: Re: [SLUG] Mailing Script Results
- From: Michael Chesterton <chesty@xxxxxxxxxxxxxxx>
- Date: Wed, 30 Aug 2006 11:43:38 +1000
- Cc: slug@xxxxxxxxxxx
- User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)
"Kevin Fitzgerald" <lists@xxxxxxxxxxxxxx> writes:
> Hi all
>
> Pretty easy one I imagine. I am doing an rsync between 2 servers and would
> like to get the results emailed to me once the script completes. I tried
> adding > mailx -s "subject" email@xxxxxxxxx to the end of my script but I
> got errors.
I usually run these scripts from cron, set the scripts output to
stdout and let cron mail the output to me.
I guess by default cron mails to root, so set up an alias so you
receive roots mail. But read crontab(5), specifically the MAILTO bit
and check /etc/crontab to double check.
If you're running the script from the command line manually, you can
do something like rsync_script | mail -s subject me@xxxxxxxxx