#! /bin/sh

# Uncomment the next line for testing
#set -x

if test $# -ne 1 ; then
  echo "Usage $0 <database>"
  exit 1
fi

FILENAME=$1-`date +%Y-%m-%d-%H%M%S`.sql.bz2
echo "\"mysql://$1\" -> \"$FILENAME\""

if test -e $FILENAME ; then
  echo "\"$FILENAME\" already exists"
  exit 1
fi

mysqldump -p --opt -Q -a $1 |bzip2 -c > $FILENAME

