Skip to content

Instantly share code, notes, and snippets.

@terrywang
Last active December 9, 2015 20:39
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 terrywang/4325418 to your computer and use it in GitHub Desktop.
Save terrywang/4325418 to your computer and use it in GitHub Desktop.
Wiki backup script, use mysqldump to dump confluence wiki database, pipe it to xz for compression and then pipe to pv to display progress and finally > wiki.xz
#!/bin/sh
# One liner
# mysqldump to stdout, pipe to xz for compression and then pipe to pv redirect to xz file
# pv is OPIONTAL, it is for showing the progress ONLY
# The - after xz -z is OPTIONAL, by default xz reads from stdin and writes to stdout
mysqldump -u confluenceuser -ppassword confluence | xz -z | pv > wiki_$(date +"%Y%m%d").xz
# Other 2 equivalant variants
# mysqldump -u confluenceuser -ppassword confluence | xz -z | > wiki_$(date +"%Y%m%d").xz
# mysqldump -u confluenceuser -ppassword confluence | xz -z - | pv > wiki_$(date +"%Y%m%d").xz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment