Table of Contents
Backup
jbackup
Create a full backup of a Joomla site: a database dump plus a compressed archive of all site files.
Usage
jbackup [-n <name>] [-b] [-z] [-t] [-o] [-s] [-h]
Options
| Option | Description |
|---|---|
-n <name> |
Name of the site to back up. If omitted, the current directory name is used. |
-b |
Save the backup in the backup folder |
-z |
Create a .zip archive instead of the default .tgz |
-t |
Add a date/time-stamp to the backup filename |
-o |
Overwrite existing backup file and/or database dump without prompting |
-s |
Silent - suppress all messages |
-h |
Display help |
What it does
- Exports the database to
db.sql.gzin the site folder usingddev export-db - Creates a compressed archive of all site files (including hidden files and folders) in the project root folder or in
BACKUPFOLDERwhen-boption is used - Removes the temporary
db.sql.gzfrom the site folder - Displays the backup path and restore instructions
Output location
Backups are saved in the root folder of the project unless the -b is used. In that case the backup is save to the BACKUPFOLDER defined in your configuration:
<sitename>.tgz- default<sitename>.zip- with-z<sitename>.20240315.143022.tgz- with-t
Restoring a backup
To restore a .tgz backup:
cd ~/Development/sites/mysite
tar xzf mysite.tgz
To restore a .zip backup:
cd ~/Development/sites/mysite
unzip -q -o mysite.zip
After restoring the files, import the database:
jdbimp
Examples
Back up the current site:
cd ~/Development/sites/mysite
jbackup
Back up a named site with a timestamp and zip format and store in the backupfolder:
jbackup -n mysite -b -z -t
Back up silently, overwriting any existing backup:
jbackup -n mysite -o -s
jbackupall
Create a full backup of all DDEV Joomla projects. This script scans for all Joomla installations and runs jbackup for each one, saving the backups to the configured backup folder.
Usage
jbackupall [-z] [-t] [-s] [-h]
Options
| Option | Description |
|---|---|
-z |
Create .zip archives instead of the default .tgz |
-t |
Add a date/time-stamp to the backup filenames |
-s |
Silent - suppress all messages |
-h |
Display help |
What it does
- Scans the
ROOTFOLDER(defined in your configuration) for all Joomla installations by locatingconfiguration.phpfiles - Runs
jbackup -bfor each found project, saving all backups to the configuredBACKUPFOLDER - Passes through any zip (
-z), timestamp (-t), and silent (-s) options to eachjbackupcall
Examples
Back up all Joomla projects:
jbackupall
Back up all projects as zip files with timestamps:
jbackupall -z -t
Back up all projects silently:
jbackupall -s