#!/bin/sh
# fait un dump de la base pre prod
user_smartpanda="smartpanda";
pass_smartpanda="**********";
schema_smartpanda="smartpanda";
user_fnb="fnb";
pass_fnb="**********";
schema_fnb="fnb";
#sp-yeoman-2

case ${1} in
        smartpanda)
                user_bdd=${user_smartpanda}
                pass_bdd=${pass_smartpanda}
                schema_bdd=${schema_smartpanda}
        ;;
        fnb)
                user_bdd=${user_fnb}
                pass_bdd=${pass_fnb}
                schema_bdd=${schema_fnb}

        ;;
        #sp-yeoman-3

        *)
                echo "Non géré";
                exit 1;
        ;;
esac
dump_dir="/home/dump/dumpInt/";
DATE_TRAIT_DHMS=`date +%Y%m%d_%Hh%M`;
echo "debut dump";
#stateName=`cat /root/outils/currentState`
mysqldump -u ${user_bdd} -p${pass_bdd} ${schema_bdd} > ${dump_dir}${schema_bdd}_${DATE_TRAIT_DHMS}.sql;
echo "dump : " ${dump_dir}${schema_bdd}_${DATE_TRAIT_DHMS}.sql ;
