Skip to content

Instantly share code, notes, and snippets.

@renekreijveld
Last active August 7, 2019 08:15
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save renekreijveld/6079147 to your computer and use it in GitHub Desktop.
Save renekreijveld/6079147 to your computer and use it in GitHub Desktop.
Dump a Joomla database to sql file.
#!/bin/sh
# jdbdump -- Dump a Joomla database to sql file.
#
# This scripts supports Joomla versions 1.0 - 3.3
#
# Copyright 2014 Rene Kreijveld - email@renekreijveld.nl
#
# This program is free software; you may redistribute it and/or modify it.
#
# Warning! This script needs the file joomlafunctions. This has to be installed in the same directory as this script.
#
# General variables
VERSION=2.0
# Determine path of script
MYPATH=$( cd $(dirname $0) ; pwd -P )
# Include general functions
. ${MYPATH}/joomlafunctions
echo "jdbdump verion ${VERSION}, written by René Kreijveld"
echo "This is a Joomla! $versr.$versd site. Starting database dump..."
# Dump the database to a .sql file
if mysqldump --skip-opt --add-drop-table --add-locks --create-options --disable-keys --lock-tables --quick --set-charset --host=$host --user=$dbuser --password=$password --socket=$MYSOCK $database > $database.sql; then
echo "$database.sql created."
ls -l $database.sql
exit 0
else
echo "Error creating database dump."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment