Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- remote_user=root
- remote_address=12.34.56.78
- mysql_password=password
- mysql_database=fume
- dump_target="~/fume_backup/$(date +%s)_fume_backup.sql"
- dump_destination="/cygdrive/y/Dropbox/Scripts/fume_backup"
- ssh="ssh $remote_user@$remote_address"
- $ssh "mkdir -p ~/fume_backup"
- $ssh "mysqldump -u root -p$mysql_password $mysql_database > $dump_target"
- scp $remote_user@$remote_address:$dump_target $dump_destination
- # clean up
- $ssh "rm $dump_target"
- # keep only the latest 5 dumps
- (cd $dump_destination && ls -t | tail -n +6 | xargs rm)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement