Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ This repository contains miscellaneous scripts used by [Wikimedia Sverige (WMSE)
* phabricator-floating-top-bar.user.css - *Stylus CSS for floating top bar in Phabricator.*
* google-flip-portrait.user.css - *Stylus CSS for flipping a portrait in google services.*
* sites-redirect-test.sh - *Prints the final URL for domains hosted on sites.wikimedia.se to quickly see that redirects work as they should.*
* wp-backup.sh - *Creates a Mysql backup from the config supplied as parameter and compresses it with Bzip2.*

When adding a script, also add it to this list with a short description.
8 changes: 8 additions & 0 deletions wp-backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /usr/bin/env bash

host=$(sudo php -r "include('$1'); echo DB_HOST;")
db=$(sudo php -r "include('$1'); echo DB_NAME;")
user=$(sudo php -r "include('$1'); echo DB_USER;")
password=$(sudo php -r "include('$1'); echo DB_PASSWORD;")

mysqldump --add-drop-table -h $host -u $user --password=$password $db | bzip2 -c | pv -p --timer --rate --bytes > backup-$(date --iso-8601).sql.bz2