Created
January 3, 2015 09:35
-
-
Save miguelfrias/3f005b3ef51743171e32 to your computer and use it in GitHub Desktop.
Backup.sh
This file contains hidden or 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 | |
siteName="{NAME}" | |
targetHTML="{your backup dir}" | |
backupDirHTML="{destination for backup}" | |
backupDirDB="{destination for backup}" | |
filenameBackupHTML="code-$siteName-$(date +"%Y%m%d-%H%M%S").tar.gz" | |
filenameBackupDB="sql-$siteName-$(date +"%Y%m%d-%H%M%S").sql" | |
echo $filenameBackupHTML | |
# Backup HTML | |
tar -zcf $backupDirHTML$filenameBackupHTML $targetHTML | |
# Backup DB | |
mysqldump -u {Your Username} -p'{Your pass}' efectofr_$siteName > $backupDirDB$filenameBackupDB | |
# Compress DB | |
gzip $backupDirDB$filenameBackupDB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment