Created
January 28, 2017 02:07
-
-
Save Tomasz-Silpion/145f6e3114f8a9a41b3637e2b2c3e7af to your computer and use it in GitHub Desktop.
Shell script for database and files site backup
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
# Database credentials | |
DB_USER="" | |
DB_PASS="" | |
DB_HOST="" | |
DB_NAME="" | |
# Database dump | |
mysqldump --user=$DB_USER --password=$DB_PASS --host=$DB_HOST $DB_NAME > $(date +"%d-%m-%Y").sql | |
# Files backup | |
tar -zcvf $(date +"%d-%m-%Y").tar.gz .. | |
# Cleanup | |
find ./* -mtime +30 -exec rm {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment