Last active
December 17, 2015 18:29
-
-
Save lincank/5653295 to your computer and use it in GitHub Desktop.
Backup with rsync
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 | |
export PATH=$PATH:/usr/bin:/usr/local/bin | |
mysqldump -uname -ppasswd db_name > /data/backup/backup_`date +%F`.sql | |
# Remove backups older than 15 days | |
find /data/backup/ -maxdepth 1 -mtime +15 -delete | |
# backup to remote server | |
rsync -arv -e "ssh -l username" /data/backup/ backup.com:~/backup/project/database |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment