Skip to content

Instantly share code, notes, and snippets.

@appastair
Last active April 12, 2019 22:29
Show Gist options
  • Save appastair/4143537 to your computer and use it in GitHub Desktop.
Save appastair/4143537 to your computer and use it in GitHub Desktop.
mysqldump diff
@midnight "sh /home/user/mysqldiff-backup.sh"
#!/bin/sh
mysqldump -u $(whoami) --password='password' --skip-opt --all-databases > dbdump-$(date +%Y-%m-%d).sql
diff --suppress-common-lines $(ls|awk '{print $1}'|grep \dbdump|tail -2) > dbdump-$(date +%Y-%m-%d).sql.diff
#!/bin/sh
patch $(find . -name dbdump-*.sql|awk '{print $1}'|head -1) < $(find . -name dbdump-*.sql.diff|awk '{print $1}'|grep \dbdump|tail -1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment