Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mediawiki backup to s3
# backup
echo Performing Mediawiki backup...
# Perform MySQL dump
echo Performing MySQL dump...
mysqldump <database_name> -h<database_host> -u<database_username> -p<database_password> > /opt/backup/data/mysql.bck
# Create mediawiki tarball
echo Creating mediawiki tarball...
cd /opt/mediawiki/
tar cf /opt/backup/data/backup.tar mediawiki-1.22.2
# Append /etc/mediawiki directory to tarball
echo Appending /etc/mediawiki to tarball...
cd /etc/mediawiki
tar rf /opt/backup/data/backup.tar .
# Append MySQL dump to tarball
echo Appending MySQL dump to tarball...
cd /opt/backup/data/
tar rf /opt/backup/data/backup.tar mysql.bck
# Create date variable
DATE=$(date +"%Y%m%d%H%M")
# Compress tarball
echo Compressing mediawiki tarball...
cd /opt/backup/data
gzip -c backup.tar > backup_$DATE.tgz
# Remove intermittent artifacts
echo Removing intermittent artifacts...
rm -f backup.tar mysql.bck
# Push backup to Amazon S3 for offsite storage
echo Pushing backup to Amazon S3 for offsite storage...
s3put brigopedia/backup_$DATE.tgz backup_$DATE.tgz
echo Done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.