Skip to content

Instantly share code, notes, and snippets.

@AlexBezuska
Last active August 29, 2015 14:15
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 AlexBezuska/a2ae29e2b36a0545b1b6 to your computer and use it in GitHub Desktop.
Save AlexBezuska/a2ae29e2b36a0545b1b6 to your computer and use it in GitHub Desktop.
mysql remote server backup script (with git)
#!/bin/sh
SERVER="servername"
USER="username"
PASSWORD="password"
NOW=$(date +"%m-%d-%Y %r")
DB="databasname"
COMMITMSG="mysql dump"
ssh $SERVER "mysqldump --verbose -u $USER --pass=$PASSWORD $DB" > $DB.sql
git status
git add $DB.sql
git commit -m "$COMMITMSG $NOW"
git log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment