public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] crontab entry
@ 2008-03-24  9:04 Kaushal Shriyan
  2008-03-24  9:14 ` Dirk Heinrichs
  2008-03-24 14:29 ` Mike Edenfield
  0 siblings, 2 replies; 14+ messages in thread
From: Kaushal Shriyan @ 2008-03-24  9:04 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 225 bytes --]

Hi I have the following entry in the crontab

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

Thanks and Regards

Kaushal

[-- Attachment #2: Type: text/html, Size: 322 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-user] crontab entry
  2008-03-24  9:04 [gentoo-user] crontab entry Kaushal Shriyan
@ 2008-03-24  9:14 ` Dirk Heinrichs
  2008-03-24  9:32   ` Kaushal Shriyan
  2008-03-24 14:29 ` Mike Edenfield
  1 sibling, 1 reply; 14+ messages in thread
From: Dirk Heinrichs @ 2008-03-24  9:14 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 454 bytes --]

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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-user] crontab entry
  2008-03-24  9:14 ` Dirk Heinrichs
@ 2008-03-24  9:32   ` Kaushal Shriyan
  2008-03-24  9:47     ` Dirk Heinrichs
  2008-03-24 10:19     ` Collin Starkweather
  0 siblings, 2 replies; 14+ messages in thread
From: Kaushal Shriyan @ 2008-03-24  9:32 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1310 bytes --]

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" <systems@webaroo.com>
in my above bash script

Thanks and Regards

Kaushal

[-- Attachment #2: Type: text/html, Size: 1974 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-user] crontab entry
  2008-03-24  9:32   ` Kaushal Shriyan
@ 2008-03-24  9:47     ` Dirk Heinrichs
  2008-03-24 10:03       ` Kaushal Shriyan
  2008-03-24 10:19     ` Collin Starkweather
  1 sibling, 1 reply; 14+ messages in thread
From: Dirk Heinrichs @ 2008-03-24  9:47 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1913 bytes --]

Am Montag, 24. März 2008 schrieb Kaushal Shriyan:
> 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" <systems@webaroo.com>
> in my above bash script
>
> Thanks and Regards
>
> Kaushal

Hmm, if the script is used from cron only, you could reduce it to the 
following (note that when run from cron, you may need to use full paths to 
your binaries, or set $PATH inside the script):

/usr/bin/rsync -av /var/lib/mysql kaushal@host77:/var/lib/ 
2>&1 |/usr/bin/tee /tmp/rsync-${TIMESTAMP}.log | /usr/bin/mailx -s "My 
subject" systems@webaroo.com

This will mail the output and save it to a file at the same time.

HTH...

	Dirk

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-user] crontab entry
  2008-03-24  9:47     ` Dirk Heinrichs
@ 2008-03-24 10:03       ` Kaushal Shriyan
  2008-03-24 11:01         ` Dirk Heinrichs
  0 siblings, 1 reply; 14+ messages in thread
From: Kaushal Shriyan @ 2008-03-24 10:03 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 3080 bytes --]

On Mon, Mar 24, 2008 at 3:17 PM, Dirk Heinrichs <dirk.heinrichs@online.de>
wrote:

> Am Montag, 24. März 2008 schrieb Kaushal Shriyan:
> > 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" <
> systems@webaroo.com>
> > in my above bash script
> >
> > Thanks and Regards
> >
> > Kaushal
>
> Hmm, if the script is used from cron only, you could reduce it to the
> following (note that when run from cron, you may need to use full paths to
> your binaries, or set $PATH inside the script):
>
> /usr/bin/rsync -av /var/lib/mysql kaushal@host77:/var/lib/
> 2>&1 |/usr/bin/tee /tmp/rsync-${TIMESTAMP}.log | /usr/bin/mailx -s "My
> subject" systems@webaroo.com
>
> This will mail the output and save it to a file at the same time.
>
> HTH...
>
>        Dirk
>

Hi Dirk,

Thanks Dirk

So the Final script looks like

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

#!/bin/bash
#rsync mysql database shell script
#author kaushal
#bash script file name rsync_mysql.sh
#created on 24/03/2008

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

if /usr/bin/rsync -av /var/lib/mysql kaushal@host77:/var/lib/ 2>&1 |
/usr/bin/tee /tmp/rsync-${TIMESTAMP}.log | /usr/bin/mailx -s "host77 DB
refresh daily" kaushal@example.com

then
        echo "Success"
else
        echo "Please check the file rsync-${TIMESTAMP}.log for errors."
fi

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

and the crontab entry would be

0 18 * * * /home/kaushal/rsync_mysql.sh


Please let me know if its correct

Thanks again

Thanks and Regards

Kaushal

[-- Attachment #2: Type: text/html, Size: 4433 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-user] crontab entry
  2008-03-24  9:32   ` Kaushal Shriyan
  2008-03-24  9:47     ` Dirk Heinrichs
@ 2008-03-24 10:19     ` Collin Starkweather
  2008-03-24 11:06       ` Peter Humphrey
  1 sibling, 1 reply; 14+ messages in thread
From: Collin Starkweather @ 2008-03-24 10:19 UTC (permalink / raw
  To: gentoo-user

Quoting Kaushal Shriyan <kaushalshriyan@gmail.com>:

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

Dirk gave a lovely one-liner, but my guess is you'll get sick of  
having to actually check the body of the e-mail to know whether there  
is a problem, so you could also put the system call to mailx in the  
if-then-else-fi and indicate in the subject line whether it is a  
success or failure.

Also, you want to cut out the echo or else cron will send an e-mail  
(remember cron sends an e-mail if there's any output from the  
command), which is redundant now that you're calling mailx.

Finally, note that you left a '>' out of your rsync call.  It's fixed below.

   #!/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
     cat /tmp/rsync-${TIMESTAMP}.log | \
       mailx -s "Success: hostxx:yyDB refresh daily" <systems@webaroo.com>
   else
     cat /tmp/rsync-${TIMESTAMP}.log | \
       mailx -s "Error: hostxx:yyDB refresh daily" <systems@webaroo.com>
   fi

Hope this helps,

Cheers,

-Collin

-- 
Collin Starkweather, Ph.D.
http://www.linkedin.com/in/collinstarkweather

--
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-user] crontab entry
  2008-03-24 10:03       ` Kaushal Shriyan
@ 2008-03-24 11:01         ` Dirk Heinrichs
  0 siblings, 0 replies; 14+ messages in thread
From: Dirk Heinrichs @ 2008-03-24 11:01 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1223 bytes --]

Am Montag, 24. März 2008 schrieb Kaushal Shriyan:

> So the Final script looks like

Is it the final script :-) ?

> #!/bin/bash
> #rsync mysql database shell script
> #author kaushal
> #bash script file name rsync_mysql.sh
> #created on 24/03/2008
>
> TIMESTAMP=`date +%Y-%m-%d-%H:%M:%S:%N`
>
> if /usr/bin/rsync -av /var/lib/mysql kaushal@host77:/var/lib/ 2>&1 |
> /usr/bin/tee /tmp/rsync-${TIMESTAMP}.log | /usr/bin/mailx -s "host77 DB
> refresh daily" kaushal@example.com
>
> then
>         echo "Success"
> else
>         echo "Please check the file rsync-${TIMESTAMP}.log for errors."
> fi
>
> Please let me know if its correct

There's no need for the if-then-else part anymore. You get the whole output 
mailed to the given address. However, if you follow Collins very good 
proposal, you could do with:

if /usr/bin/rsync -av /var/lib/mysql kaushal@host77:/var/lib/ 
> /tmp/rsync-${TIMESTAMP}.log 2>&1
then
	subj_prefix="Success"
else
	subj_prefix="Error"
fi
cat /tmp/rsync-${TIMESTAMP}.log| /usr/bin/mailx -s "${subj_prefix}: host77 DB 
refresh daily" kaushal@example.com

So that you can tell from the subject wether the command was succesful or not.

Bye...

	Dirk

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-user] crontab entry
  2008-03-24 10:19     ` Collin Starkweather
@ 2008-03-24 11:06       ` Peter Humphrey
  2008-03-24 12:25         ` Kaushal Shriyan
  0 siblings, 1 reply; 14+ messages in thread
From: Peter Humphrey @ 2008-03-24 11:06 UTC (permalink / raw
  To: gentoo-user

On Monday 24 March 2008 10:19:25 Collin Starkweather wrote:

> ... you left a '>' out of your rsync call. It's fixed below.

His version is exactly the same as yours, apart from layout. I suggest that 
the '>' at the beginning of a line has confused your mail reader.

-- 
Rgds
Peter
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-user] crontab entry
  2008-03-24 11:06       ` Peter Humphrey
@ 2008-03-24 12:25         ` Kaushal Shriyan
  2008-03-24 13:43           ` Uwe Thiem
  0 siblings, 1 reply; 14+ messages in thread
From: Kaushal Shriyan @ 2008-03-24 12:25 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 926 bytes --]

On Mon, Mar 24, 2008 at 4:36 PM, Peter Humphrey <peter@humphrey.ukfsn.org>
wrote:

> On Monday 24 March 2008 10:19:25 Collin Starkweather wrote:
>
> > ... you left a '>' out of your rsync call. It's fixed below.
>
> His version is exactly the same as yours, apart from layout. I suggest
> that
> the '>' at the beginning of a line has confused your mail reader.
>
> --
> Rgds
> Peter
> --
> gentoo-user@lists.gentoo.org mailing list
>
>
Hi Collin

I have two scripts file
one is http://pastebin.com/m263e6f3c and http://pastebin.com/m175098db.

The requirement is run http://pastebin.com/m175098db script once the below
line succeeds in the http://pastebin.com/m263e6f3c

if /usr/bin/rsync -av /var/lib/mysql host77:/var/lib/ >
/tmp/rsync-${TIMESTAMP}.log 2>&1
then
  /usr/bin/mailx -s "Success: host77 DB refresh daily" kaushal@example.com <
/tmp/rsync-${TIMESTAMP}.log

I am not able to proceed

Thanks and Regards

Kaushal

[-- Attachment #2: Type: text/html, Size: 1648 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-user] crontab entry
  2008-03-24 12:25         ` Kaushal Shriyan
@ 2008-03-24 13:43           ` Uwe Thiem
  0 siblings, 0 replies; 14+ messages in thread
From: Uwe Thiem @ 2008-03-24 13:43 UTC (permalink / raw
  To: gentoo-user

On Monday 24 March 2008, Kaushal Shriyan wrote:
> On Mon, Mar 24, 2008 at 4:36 PM, Peter Humphrey
> <peter@humphrey.ukfsn.org>
>
> wrote:
> > On Monday 24 March 2008 10:19:25 Collin Starkweather wrote:
> > > ... you left a '>' out of your rsync call. It's fixed below.
> >
> > His version is exactly the same as yours, apart from layout. I
> > suggest that
> > the '>' at the beginning of a line has confused your mail reader.
> >
> > --
> > Rgds
> > Peter
> > --
> > gentoo-user@lists.gentoo.org mailing list
>
> Hi Collin
>
> I have two scripts file
> one is http://pastebin.com/m263e6f3c and
> http://pastebin.com/m175098db.
>
> The requirement is run http://pastebin.com/m175098db script once
> the below line succeeds in the http://pastebin.com/m263e6f3c
>
> if /usr/bin/rsync -av /var/lib/mysql host77:/var/lib/ >
> /tmp/rsync-${TIMESTAMP}.log 2>&1
> then
>   /usr/bin/mailx -s "Success: host77 DB refresh daily"
> kaushal@example.com < /tmp/rsync-${TIMESTAMP}.log
>
> I am not able to proceed

Make that last line:
cat /tmp/rsync-${TIMESTAMP}.log | mailx -s "blablabla"...

Uwe


-- 
Informal Linux Group Namibia:
http://www.linux.org.na/
SysEx (Pty) Ltd.:
http://www.SysEx.com.na/
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-user] crontab entry
  2008-03-24  9:04 [gentoo-user] crontab entry Kaushal Shriyan
  2008-03-24  9:14 ` Dirk Heinrichs
@ 2008-03-24 14:29 ` Mike Edenfield
  2008-03-24 15:43   ` Kaushal Shriyan
  1 sibling, 1 reply; 14+ messages in thread
From: Mike Edenfield @ 2008-03-24 14:29 UTC (permalink / raw
  To: gentoo-user

Kaushal Shriyan wrote:
> Hi I have the following entry in the crontab
> 
> 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
> 
> Thanks and Regards
> 
> Kaushal
> 

The easiest way is to write a wrapper script; I have a few of them that 
do something like:


(
echo "From: songbird.jungle <root@songbird.jungle>"
echo "To: Michael Edenfield <kutulu@kutulu.org>"
echo "Subject: Portage Update Report"
echo ""

# do stuff here.

) | sendmail kutulu@kutulu.org

-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-user] crontab entry
  2008-03-24 14:29 ` Mike Edenfield
@ 2008-03-24 15:43   ` Kaushal Shriyan
  2008-03-24 17:52     ` Kaushal Shriyan
  0 siblings, 1 reply; 14+ messages in thread
From: Kaushal Shriyan @ 2008-03-24 15:43 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1228 bytes --]

On Mon, Mar 24, 2008 at 7:59 PM, Mike Edenfield <kutulu@kutulu.org> wrote:

> Kaushal Shriyan wrote:
> > Hi I have the following entry in the crontab
> >
> > 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
> >
> > Thanks and Regards
> >
> > Kaushal
> >
>
> The easiest way is to write a wrapper script; I have a few of them that
> do something like:
>
>
> (
> echo "From: songbird.jungle <root@songbird.jungle>"
> echo "To: Michael Edenfield <kutulu@kutulu.org>"
> echo "Subject: Portage Update Report"
> echo ""
>
> # do stuff here.
>
> ) | sendmail kutulu@kutulu.org
>
> --
> gentoo-user@lists.gentoo.org mailing list
>
>

Hi,

I have two scripts file one is http://pastebin.com/m263e6f3c and
http://pastebin.com/m175098db.

The requirement is run http://pastebin.com/m175098db script once the below
line succeeds in the http://pastebin.com/m263e6f3c

if /usr/bin/rsync -av /var/lib/mysql host77:/var/lib/ >
/tmp/rsync-${TIMESTAMP}.log 2>&1
then
  /usr/bin/mailx -s "Success: host77 DB refresh daily" kaushal@example.com <
/tmp/rsync-${TIMESTAMP}.log

I am not able to proceed

Thanks and Regards

Kaushal

[-- Attachment #2: Type: text/html, Size: 2341 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-user] crontab entry
  2008-03-24 15:43   ` Kaushal Shriyan
@ 2008-03-24 17:52     ` Kaushal Shriyan
       [not found]       ` <6b16fb4c0803242341h14670830m514e95b7a17992@mail.gmail.com>
  0 siblings, 1 reply; 14+ messages in thread
From: Kaushal Shriyan @ 2008-03-24 17:52 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1514 bytes --]

On Mon, Mar 24, 2008 at 9:13 PM, Kaushal Shriyan <kaushalshriyan@gmail.com>
wrote:

> On Mon, Mar 24, 2008 at 7:59 PM, Mike Edenfield <kutulu@kutulu.org> wrote:
>
> > Kaushal Shriyan wrote:
> > > Hi I have the following entry in the crontab
> > >
> > > 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
> > >
> > > Thanks and Regards
> > >
> > > Kaushal
> > >
> >
> > The easiest way is to write a wrapper script; I have a few of them that
> > do something like:
> >
> >
> > (
> > echo "From: songbird.jungle <root@songbird.jungle>"
> > echo "To: Michael Edenfield <kutulu@kutulu.org>"
> > echo "Subject: Portage Update Report"
> > echo ""
> >
> > # do stuff here.
> >
> > ) | sendmail kutulu@kutulu.org
> >
> > --
> > gentoo-user@lists.gentoo.org mailing list
> >
> >
>
> Hi,
>
> I have two scripts file one is http://pastebin.com/m263e6f3c and
> http://pastebin.com/m175098db.
>
> The requirement is run http://pastebin.com/m175098db script once the below
> line succeeds in the http://pastebin.com/m263e6f3c
>
> if /usr/bin/rsync -av /var/lib/mysql host77:/var/lib/ >
> /tmp/rsync-${TIMESTAMP}.log 2>&1
> then
>   /usr/bin/mailx -s "Success: host77 DB refresh daily" kaushal@example.com< /tmp/rsync-${TIMESTAMP}.log
>
> I am not able to proceed
>
> Thanks and Regards
>
> Kaushal
>

Hi

I have combined the script http://pastebin.com/m77e0e752, is it ok

Thanks and Regards

Kaushal

[-- Attachment #2: Type: text/html, Size: 3001 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-user] crontab entry
       [not found]       ` <6b16fb4c0803242341h14670830m514e95b7a17992@mail.gmail.com>
@ 2008-03-25  7:37         ` Kaushal Shriyan
  0 siblings, 0 replies; 14+ messages in thread
From: Kaushal Shriyan @ 2008-03-25  7:37 UTC (permalink / raw
  To: gentoo-user; +Cc: Collin Starkweather

[-- Attachment #1: Type: text/plain, Size: 2601 bytes --]

On Tue, Mar 25, 2008 at 12:11 PM, Kaushal Shriyan <kaushalshriyan@gmail.com>
wrote:

> On Mon, Mar 24, 2008 at 11:22 PM, Kaushal Shriyan <
> kaushalshriyan@gmail.com> wrote:
>
> > On Mon, Mar 24, 2008 at 9:13 PM, Kaushal Shriyan <
> > kaushalshriyan@gmail.com> wrote:
> >
> > > On Mon, Mar 24, 2008 at 7:59 PM, Mike Edenfield <kutulu@kutulu.org>
> > > wrote:
> > >
> > > > Kaushal Shriyan wrote:
> > > > > Hi I have the following entry in the crontab
> > > > >
> > > > > 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
> > > > >
> > > > > Thanks and Regards
> > > > >
> > > > > Kaushal
> > > > >
> > > >
> > > > The easiest way is to write a wrapper script; I have a few of them
> > > > that
> > > > do something like:
> > > >
> > > >
> > > > (
> > > > echo "From: songbird.jungle <root@songbird.jungle>"
> > > > echo "To: Michael Edenfield <kutulu@kutulu.org>"
> > > > echo "Subject: Portage Update Report"
> > > > echo ""
> > > >
> > > > # do stuff here.
> > > >
> > > > ) | sendmail kutulu@kutulu.org
> > > >
> > > > --
> > > > gentoo-user@lists.gentoo.org mailing list
> > > >
> > > >
> > >
> > > Hi,
> > >
> > > I have two scripts file one is http://pastebin.com/m263e6f3c and
> > > http://pastebin.com/m175098db.
> > >
> > > The requirement is run http://pastebin.com/m175098db script once the
> > > below line succeeds in the http://pastebin.com/m263e6f3c
> > >
> > > if /usr/bin/rsync -av /var/lib/mysql host77:/var/lib/ >
> > > /tmp/rsync-${TIMESTAMP}.log 2>&1
> > > then
> > >   /usr/bin/mailx -s "Success: host77 DB refresh daily"
> > > kaushal@example.com < /tmp/rsync-${TIMESTAMP}.log
> > >
> > > I am not able to proceed
> > >
> > > Thanks and Regards
> > >
> > > Kaushal
> > >
> >
> > Hi
> >
> > I have combined the script http://pastebin.com/m77e0e752, is it ok
> >
> > Thanks and Regards
> >
> > Kaushal
> >
> >
>
> Hi Collin,
>
> I have http://pastebin.com/d65195b48, I want to know how much time it
> takes to execute the script,
>
> I know the time command
>
> { time sudo /usr/bin/rsync -av /var/lib/mysql kaushal@host77:/var/lib/; }
> 2>/tmp/time.output
>
> is there a way to call the time command inside the
> http://pastebin.com/d65195b48 script
>
> Thanks and Regards
>
> Kaushal
>


Hi Collin

I could incorporate the time command in my script
http://pastebin.com/d1324bbd8

http://pastebin.com/d1324bbd8 is the modified script. Just wanted to know
the elasped time in minutes instead of seconds

Thanks and Regards

Kaushal

[-- Attachment #2: Type: text/html, Size: 4695 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-03-25  7:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-24  9:04 [gentoo-user] crontab entry Kaushal Shriyan
2008-03-24  9:14 ` Dirk Heinrichs
2008-03-24  9:32   ` Kaushal Shriyan
2008-03-24  9:47     ` Dirk Heinrichs
2008-03-24 10:03       ` Kaushal Shriyan
2008-03-24 11:01         ` Dirk Heinrichs
2008-03-24 10:19     ` Collin Starkweather
2008-03-24 11:06       ` Peter Humphrey
2008-03-24 12:25         ` Kaushal Shriyan
2008-03-24 13:43           ` Uwe Thiem
2008-03-24 14:29 ` Mike Edenfield
2008-03-24 15:43   ` Kaushal Shriyan
2008-03-24 17:52     ` Kaushal Shriyan
     [not found]       ` <6b16fb4c0803242341h14670830m514e95b7a17992@mail.gmail.com>
2008-03-25  7:37         ` Kaushal Shriyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox