Created
November 21, 2013 20:04
-
-
Save fcingolani/7588596 to your computer and use it in GitHub Desktop.
Blackup. Simple filesystem and mysql database backup script. Usage: ./blackup.sh blackup_plan.sh
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/bash | |
# Requirements: | |
# - mysqldump | |
echo "Running backup plan $1"; | |
source $1; | |
database_dump_file="$backup_dir/database.sql"; | |
filesystem_backup_file="$backup_dir/filesystem.tar.gz"; | |
echo "Creating backup directory"; | |
mkdir -p "$backup_dir"; | |
echo "Compressing filesystem"; | |
tar czf "$filesystem_backup_file" "$filesystem_path"; | |
echo "Dumping database"; | |
mysqldump --port $database_port --protocol TCP --user $database_user --host $database_host -p$database_pass $database_name > $database_dump_file; | |
echo "Compressing database dump"; | |
gzip -f "$database_dump_file"; | |
echo "Done"; |
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/bash | |
backup_dir="/destination/path"; | |
filesystem_path="/source/path"; | |
database_port="3306"; | |
database_user="root"; | |
database_host="localhost"; | |
database_pass="????"; | |
database_name="database"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment