mysqldump --no-create-info -h CMS-AUTH01 -uroot -pezidentity eziden > sync.sql
echo "Sync data retrieved..."
mysql -uroot -pezidentity -e "drop database eziden;"
mysql -uroot -pezidentity -e "create database eziden;"
echo "Database initialized for sync..."
mysql -uroot -pezidentity eziden < /usr/ezidentity/scripts/cron/tables.sql
echo "Database sync in progress..."
mysql -uroot -pezidentity eziden < /usr/ezidentity/scripts/cron/sync.sql
echo "Database sync completed."
2. dump mysql database using below command. This command will dump tables structure only without dumping data.
mysqldump -d -uroot -pezidentity eziden > eziden.sql
3.add cron jab using below command
$ crontab -e
Note: point to above script (sync.sh)
00 3 * * * bash /usr/ezidentity/scripts/cron/sync.sh
No comments:
Post a Comment