Java Mailing List Archive

http://www.redhatconfig.com/

Home » Gentoo Linux »

Re: [gentoo-user] crontab entry

Kaushal Shriyan

2008-03-24

Replies:

Author LoginPost Reply
On Mon, Mar 24, 2008 at 2:44 PM, Dirk Heinrichs <dirk.heinrichs@online.de> wrote:
Am Montag, 24. März 2008 schrieb Kaushal Shriyan:

> MAILTO=systems@webaroo.com
> 0 18 * * * /home/kaushal/rsync_mysql.sh
>
> I want my subject line to be "hostxx:yyDB refresh daily"
>
> is there a way to do it

Don't rely on cron to send the mail, use mailx inside your script instead.
That means, inside the script, capture all output in a temp. file, then use

cat /tmp/file|mailx -s "my subject" systems@webaroo.com

HTH...

       Dirk

Hi Dirk

Below is my script
#############################################################################

#!/bin/bash
#rsync mysql database shell script
#author kaushal
#created on 21/03/2008

TIMESTAMP=`date +%Y-%m-%d-%H:%M:%S:%N`

if rsync -av /var/lib/mysql kaushal@host77:/var/lib/ >/tmp/rsync-${TIMESTAMP}.log 2>&1
then
        echo "Success"
else
        echo "Please check the file rsync-${TIMESTAMP}.log for errors."
fi

#############################################################################

so according to your suggestion where does this line fits "cat /tmp/file|mailx -s "my subject" systems@webaroo.com"
in my above bash script

Thanks and Regards

Kaushal

©2008 redhatconfig.com - Jax Systems, LLC, U.S.A.