Created
June 16, 2015 23:10
-
-
Save clasense4/9160b64f553c1c7bd79a to your computer and use it in GitHub Desktop.
Simple backup file use it with crontab
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 | |
now="$(date +'%Y_%m_%d_%H_%M')" | |
filename_app="CRM_APP_$now".tar.gz | |
filename_db="CRM_DB_$now".sql.gz | |
backupfolder="/home/backup" | |
backupfolder_app="/var/www/website" | |
fullpathbackupfile_db="$backupfolder/$filename_db" | |
fullpathbackupfile_app="$backupfolder/$filename_app" | |
# execute mysql | |
mysqldump -u user -pPasswd -h xxx.xxx.xxx.xxx databases | gzip -9 > "$fullpathbackupfile_db" | |
echo "$fullpathbackupfile_db" | |
# execute app folder | |
tar cfz "$fullpathbackupfile_app" "$backupfolder_app" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment