Created
February 25, 2016 09:57
-
-
Save kfreiman/a83b8fd83cfaf3fea581 to your computer and use it in GitHub Desktop.
MySQL dump, send to another server and clean old files script
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
mysqldump -uuser -ppass -hhost basename | gzip > `date +/local/path/%Y%m%d.%H%M%S.sql.gz` | |
sshpass -p "pass" rsync -r /local/path/ remoteuser@host:/remote/path | |
find /local/path -name "*.sql.gz" -mtime +7 -exec rm {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment