From owner-freebsd-questions@FreeBSD.ORG Thu Aug 16 15:35:38 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6383916A417 for ; Thu, 16 Aug 2007 15:35:38 +0000 (UTC) (envelope-from mnslinky@gmail.com) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.177]) by mx1.freebsd.org (Postfix) with ESMTP id 21F6513C457 for ; Thu, 16 Aug 2007 15:35:37 +0000 (UTC) (envelope-from mnslinky@gmail.com) Received: by py-out-1112.google.com with SMTP id u77so468412pyb for ; Thu, 16 Aug 2007 08:35:37 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:content-type:message-id:content-transfer-encoding:x-mailer:from:subject:date:to; b=qwQODMmDlaAkQi0seYJhFj/QNfXdkOwms/uR2DDztMz7F03qehIakBviUiYgxTTnQnpt0od4emOPtDX6lZ1e6sUwqsES2OWON1ZmZBl+aOI9Pk1rz8j+rEblIWPoa7kiCkqB9orRlQ8wOb2czND/tjx/EVHFbAl+m8Pj702o+eU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:content-type:message-id:content-transfer-encoding:x-mailer:from:subject:date:to; b=KfzInnwYnjtKZ42TDvb1nPhIkzemeUuHbCVNDRfsjXQUbi7CX7BCL8fVpJHz2D+nVm+iQPQMgRWXW7Vu/l0Eyp1mTx6ta5DrcGHxnSDr5TtPM3skPQz1RG2TddqasIrdfRlmitnPpogtnvD/fetI7qjtoshJUSJT008x27o/2q0= Received: by 10.35.115.18 with SMTP id s18mr2107926pym.1187278536846; Thu, 16 Aug 2007 08:35:36 -0700 (PDT) Received: from ?10.0.0.14? ( [74.95.66.25]) by mx.google.com with ESMTPS id f24sm1685472pyh.2007.08.16.08.35.32 (version=SSLv3 cipher=OTHER); Thu, 16 Aug 2007 08:35:33 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <1A4196AD-1749-40BC-8F41-3F4E4715096C@gmail.com> Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.752.3) From: Eric Crist Date: Thu, 16 Aug 2007 10:35:31 -0500 To: Questions User Subject: mysqldump/gzip shell scripting question... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Aug 2007 15:35:38 -0000 Hey all, First off, I don't care if you send example in perl, php, or sh, but we're not a python shop here, so those recommendation will not be useful... I'm trying to write a shell script that scans our databases for tables starting with archive_ which are created by other scripts/ departments, etc. This script needs to perform a mysqldump of that table, and then gzip it. It's MUCH quick to pipe directly to gzip, than perform the dump, then gzip that. The problem is, this table to filesystem dump is also going to drop those archive_* tables. We would like to know that the mysqldump worked before we do this. The problem we're having, as I'm sure others have run into (at least according to Google), is that a command such as the following leaves no apparent easy way to capture the exit status of the mysqldump command: # mysqldump -u $USER -p$PASS $DBHOST $DATABASE $TABLE | gzip > $TABLE.sql.gz Anyone have any good recommendations? Thanks! Eric Crist