Created
August 15, 2011 06:07
-
-
Save kylehotchkiss/1145780 to your computer and use it in GitHub Desktop.
Wordpress backup. Needs python, mysql, and bzip to work. Make it executable and place it in your cron for daily backups
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
## | |
## Backup for Wordpress | |
## By Hotchkissmade / Kyle Hotchkiss | |
## | |
import time, os | |
# ------------- # | |
# Configuration # | |
# ------------- # | |
mysqluser = 'debian-sys-maint' # Debian & deriv. can use the debian-sys-maint account for this. | |
mysqlpass = '' # debian sys main pass in /etc/mysql/debian.cnf | |
mysqlhost = 'localhost' | |
database = '' | |
# ------------- # | |
# Startup Stuff # | |
# ------------- # | |
home = os.path.expanduser("~") | |
if os.path.isdir(home + "/Wordpress") != True: | |
os.mkdir(home + "/Wordpress") | |
# ------------------- # | |
# Backup the database # | |
# ------------------- # | |
os.system("mysqldump --add-drop-table -h " + mysqlhost + " -u" + mysqluser + " -p" + mysqlpass + " " + database + " | bzip2 -c > ~/Wordpress/wp" + time.strftime("%m%d%y") + ".sql.bz2") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment