Last Updated: 04 Feb 2017
The backup.sh script can be run from the root directory to back up all files and database data from your Squiz Matrix installation to a single tar.gz file.
This script is located in the /scripts directory of your Squiz Matrix system.
You can enter the optional argument --database-only to only backup the database data from your installation. This is useful if you already have another method of backing up your files.
You can use the --verbose option argument to view the progress of the script as it is running.
Creating a Backup
It is recommended that regular backups should be taken of your Squiz Matrix system, especially when upgrading or making an significant system changes.
To create a backup of your Squiz Matrix system, use the backup.sh script, as follows:
$ scripts/backup.sh /path/to/matrix
By default, this script will create a backup file based on the current date and time in the Squiz Matrix root directory. Please note that this process can be quite lengthy if you have a larger system with a large volume of content.
Alternatively, you can choose the directory to create the backup file in. For example, the following command will create a backup in the /home/backups directory.
$ scripts/backup.sh /path/to/matrix /home/backups
The script accepts the following options:
- --verbose: View the progress of the script as it is running.
- --database-only: Only backup the database data from your installation. This is useful if you already have another method of backing up your files.
- --tostdout: Instead of creating a file for the output of the script, send it to stdout. This is useful for piping though another program, eg gpg.
If your Squiz Matrix installation is on an Oracle database located on a separate server, the backup.sh script will require you to make an ssh connection to the database server. This is not required for PostgresSQL-based systems.
$ scripts/backup.sh /path/to/matrix --email@example.com
Or to backup to a specified directory:
$ ./scripts/backup.sh /path/to/matrix /path/to/backup/folder --firstname.lastname@example.org
Restoring From a Backup
If your system is corrupt or not working correctly, you may need to restore your Squiz Matrix installation from a previously created backup.
Restoring from a backup will remove your existing system, including all file systems and database data. You should consider backing-up your current system before replacing it with an old backup to ensure no data is lost.
Restoring the File System
The following commands will delete your existing Squiz Matrix source files and file system data, replacing them with the backed-up copies. In this example, we are backing up from the mybackup.tar.gz file in the home/backups directory using the database name squiz_matrix.
$ cd home/websites $ rm -rf squiz_matrix $ mkdir squiz_matrix $ cd squiz_matrix $ cp home/backups/mybackup.tar.gz . $ tar -zxvf mybackup.tar.gz
Restoring the Database
The extraction of the backup file will create a file with a .dump extension. This is the dump of your Squiz Matrix database. Depending on the database type your system is installed on, the command for restoring the database is as follows:
The following commands will restore the Squiz Matrix database, where squiz_matrix is the name of your database, username is the user that Squiz Matrix uses to connect to its database, and dumpfile.dump is the name of the database dump file extracted from the backup file.
$ dropdb -U postgres squiz_matrix $ createdb -U postgres -O username -E UTF8 squiz_matrix $ createlang -U postgres plpgsql squiz_matrix $ psql -U postgres -f dumpfile.dump squiz_matrix
The following commands will restore the Squiz Matrix database, where SID is the session ID and dumpfile.dump is the name of the database dump file extracted from the backup file.
$ imp username/password@SID file=dumpfile.dump
- Software Configuration Files
- Pre-Uploading Files
- Creating a robots.txt file
- Upgrade Script
- Maintenance Tasks
- Memcache Configuration
- Redis Configuration
- Annotated main.inc
- Squiz Matrix Script Index
- Import/Export Scripts
- Move Assets Scripts
- System Integrity Scripts
- System Management Scripts
- Remove Assets Scripts
- Backup Script
- Purge Trash Script
- Recreate Link Tree Script
- Remove Internal Message Script
- Add/Remove URL Script
- Replace URL Script
- Reset Root Password Script
- Rollback Management Script
- Session Cleanup Script
- System Move Update Script
- System Parse Design Scripts
- Publish Static Content Script
- System Check Script
- Matrix SQL Client
- Update LDAP Bridge References Script
Noticed an error?
Want to suggest an improvement?