Last active
September 14, 2018 03:19
-
-
Save eftakhairul/3b596055399480012d5f3f83dc2d22e8 to your computer and use it in GitHub Desktop.
Dump your db using bzip2 compression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Creates database backups using mysqldump. It uses bzip2 for compression, and | |
# the filename of the dump is DB- and the current timestamp. The dumps are stored | |
# in ARCHIVE_DIR and bzip2 is called with nice to make it softer on the server. | |
ARCHIVE_DIR=~/backup | |
FILENAME=$(date '+%Y-%m-%d_%H:%M:%S') | |
USER=root | |
PASS=your_db_password | |
OPTIONS="-A -e" | |
mysqldump $OPTIONS -u $USER -p$PASS | nice bzip2 -9 > $ARCHIVE_DIR/DB-$FILENAME.sql.bz2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment