Skip to content

Instantly share code, notes, and snippets.

@lincank
Last active December 17, 2015 18:29
Show Gist options
  • Save lincank/5653295 to your computer and use it in GitHub Desktop.
Save lincank/5653295 to your computer and use it in GitHub Desktop.
Backup with rsync
#!/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