Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- MYSQL_HOST=127.0.0.1
- PORT=3306
- DATABASE=world
- DBUSER=root
- PASS=ghbdtn
- BEGIN_DUMP_DIRECTORY=/root/mysql/
- LAST_DUMP_DIRECTORY=
- DATE='date +%m_%d_%y_%H_%m_%s'
- if [ -d "$DIRECTORY" ]; then
- mkdir $BEGIN_DUMP_DIRECTORY/old $BEGIN_DUMP_DIRECTORY/new $BEGIN_DUMP_DIRECTORY/migrations; else
- echo '$BEGIN_DUMP_DIRECTORY not found'
- fi
- #Create a first schema dump for comparison if begin.sql not exist create it
- if [ -a $BEGIN_DUMP_DIRECTORY/begin.sql ]; then
- mysqldump -u $DBUSER -p$PASS --no-data $DATABASE > $BEGIN_DUMP_DIRECTORY/new/mysql_$DATE.sql; else
- mysqldump -u $DBUSER -p$PASS --no-data $DATABASE > $BEGIN_DUMP_DIRECTORY/begin.sql;
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement