#!/bin/sh
# Author:   Thien Ho <thien@bibliofiche.com>
# Created:  Tue, Feb 21, 2006 @ 13:59:28 EST
# Updated:
# -

ZPORT=210

# Source common functions
#. /data/idzebra-210/zebra.function
. /etc/opals/function

cleanDb=0
zdb=''
while getopts "cd:" option; do
    case $option in
        c) cleanDb=1
           ;;
        d) zdb=`echo $OPTARG | tr -d '[:space:][:punct:]'`
           ;;
        *) echo Invalid options.
           exit 2
           ;;
    esac
done

if [ "$zdb" == "" ]; then
    cat <<_ERR_MSG_
ERROR::$SCRIPTNAME: missing database
Usage:
  $SCRIPTNAME -c -d DATABASE
    -c: clean MySQL database
    -d: database name
_ERR_MSG_
    exit 1
fi

cleanDatabase $zdb

if [ $cleanDb -eq 1 ]; then
    cleanMysqlDatabase $zdb
fi

exit 0
