Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Mailing Script Results


"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