Backup and Restore

From Tine 2.0 - Wiki

This page describes how to backup and restore Tine20 on a Linux/Unix system with MySQL database backend.

Backup and Restore CLI functions

CLI functions for backup and restore have been implemented in Elena 2015.07 (see:

Backup and restore is now that easy:

backup (db, config and files)

 php setup.php --config /path/to/ --backup -- config=1 db=1 files=1 backupDir=/var/tmp/backup noTimestamp=1


 php setup.php --config /path/to/ --restore -- config=1 db=1 files=1 backupDir=/var/tmp/backup



The following backup commands produce files with a timestamp in their filenames. This makes it easier to see when the backup was created. But if you run this commands as cron job, don't forget to remove old files, or your partition will run out of space sooner or later!


tar -jcf Tine-files_$(date +%Y-%m-%d_%H-%M-%S).tar.bz2 /path/to/your/Tine20_installation

The result is a bzip2 compressed tar archive containing all files of your Tine20 installation (Sample filename: 'Tine-files_2010-10-15_00-00-00.tar.bz2').


Replace the curly brackets with the corresponding values from your

mysqldump -u{Tine_DB_User} -p{Tine_DB_Password} {Tine_DB_Name} -e --create-options -c --add-drop-table --add-locks -l \
> /place/for/your/backup/Tine-database_$(date +%Y-%m-%d_%H-%M-%S).sql

The result is an uncompressed database dump (Sample filename: 'Tine-database_2010-10-15_00-00-00.sql').

If you prefer a bzip2 compressed export run instead:

mysqldump -u{Tine_DB_User} -p{Tine_DB_Password} {Tine_DB_Name} -e --create-options -c --add-drop-table --add-locks -l -B | bzip2 \
> /place/for/your/backup/Tine-database_$(date +%Y-%m-%d_%H-%M-%S).sql.bz2

The result is bzip2 compressed database dump (Sample filename: 'Tine-database_2010-10-15_00-00-00.sql.bz2').

The commands are split into two lines, because of their length. The backslash make sure that it is interpeted as one line. So you can copy/paste it, or if you want to have it in one line, remove the backslash.

If you are interested in the meaning of the mysqldump parameters, see the mysqldump manpage.


The following expects, that you used the previous commands for backup with all their parameters.


Go to the root (/) of your filesystem and unpack the .tar.bz2 archive:

cd /
tar -jxf /path/to/your/backup-files/Tine-files_2010-10-15_00-00-00.tar.bz2

Replace the filename with the one of the file you want to restore.

All files are restored exactly to the same place they were during the backup.


Replace the curly brackets with the corresponding values from your

The following command restores your database, from an uncompressed dump:

mysql -u{Tine_DB_User} -p{Tine_DB_Password} < /path/to/your/backup-files/

If you created a bzip2 compressed dump, use the following command to unzip and restore the database at once:

bunzip2 < Tine-database_2010-10-15_00-00-00.sql.bz2 | mysql -u{Tine_DB_User} -p{Tine_DB_Password}

Both restore commands, create the database if it doesn't already exist. If tables which have to restored, allready exist, they'll be dropped before!