Skip to content

Instantly share code, notes, and snippets.

@papettoTV
Created September 13, 2011 06:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save papettoTV/1213245 to your computer and use it in GitHub Desktop.
Save papettoTV/1213245 to your computer and use it in GitHub Desktop.
DBデータ(mysql)を他のサーバにバックアップ
#!/bin/sh
youbi=`date +%w`
dmpfile="db_"${youbi}".dmp.gz"
mysqldump -u user -ppassword --databases databasename | gzip > ${dmpfile}
exec ssh-agent scp ${dmpfile}.gz user@backup_server:/backup/dir/path &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment