From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([69.77.167.62] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1JdkQi-0006WW-Ng for garchives@archives.gentoo.org; Mon, 24 Mar 2008 11:01:28 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 19247E0634; Mon, 24 Mar 2008 11:01:27 +0000 (UTC) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by pigeon.gentoo.org (Postfix) with ESMTP id C8EAAE0634 for ; Mon, 24 Mar 2008 11:01:26 +0000 (UTC) Received: from rohan.altum.de (p54BBA3DA.dip0.t-ipconnect.de [84.187.163.218]) by mrelayeu.kundenserver.de (node=mrelayeu8) with ESMTP (Nemesis) id 0ML31I-1JdkQg0bT9-0003af; Mon, 24 Mar 2008 12:01:26 +0100 To: gentoo-user@lists.gentoo.org Date: Mon, 24 Mar 2008 12:01:18 +0100 Subject: Re: [gentoo-user] crontab entry Message-ID: <200803241201.23014.dirk.heinrichs@online.de> From: "Dirk Heinrichs" Organization: Mail Received: from gondolin (gondolin.altum.de [192.168.2.24]) by rohan.altum.de; Mon, 24 Mar 2008 12:01:24 +0100 Organization: Privat User-Agent: KMail/1.9.9 References: <6b16fb4c0803240204w227edc7ch894f5cd224ace0be@mail.gmail.com> <200803241047.58007.dirk.heinrichs@online.de> <6b16fb4c0803240303k39f430e8n78f1381c84fbde6@mail.gmail.com> In-Reply-To: <6b16fb4c0803240303k39f430e8n78f1381c84fbde6@mail.gmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart38920377.4o0uYTNXIP"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX1+mY2SPcYWyIVqpjo+GPsUyVqvz0VT8t0cVmz5 x+wktmo/kzfvNvD2M/Sbk7r0SWiOAOSnrAps+zFZpbTFb35Xge rPJgRUPLOdqVZ2zzDc9Uw== X-Archives-Salt: db79ae27-9ed8-4009-8ee4-e3cdbf198a65 X-Archives-Hash: 577da4f89785b5e6166735b1eead6842 --nextPart38920377.4o0uYTNXIP Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Am Montag, 24. M=C3=A4rz 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=3D`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= =20 mailed to the given address. However, if you follow Collins very good=20 proposal, you could do with: if /usr/bin/rsync -av /var/lib/mysql kaushal@host77:/var/lib/=20 > /tmp/rsync-${TIMESTAMP}.log 2>&1 then subj_prefix=3D"Success" else subj_prefix=3D"Error" fi cat /tmp/rsync-${TIMESTAMP}.log| /usr/bin/mailx -s "${subj_prefix}: host77 = DB=20 refresh daily" kaushal@example.com So that you can tell from the subject wether the command was succesful or n= ot. Bye... Dirk --nextPart38920377.4o0uYTNXIP Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) iD8DBQBH54oC8NVtnsLkZ7sRArV3AJ0XLq58iMu/tO4Lx2amRvrxxptBXwCfUNSb NroX5bfBYEkGYAbq8BDFuoA= =9tE6 -----END PGP SIGNATURE----- --nextPart38920377.4o0uYTNXIP-- -- gentoo-user@lists.gentoo.org mailing list