Tuesday, November 20, 2012

Subversion backup on linux


BACKUP

To make a complete copy of the Subversion repository system just follow these small steps:

- Locate the repository directory, in our case: / var / lib / svn
- Locate the destination directory for the backup, in our case: / tmp /
- Perform a dump of the repository with the following command:

sudo svnadmin dump / var / lib / svn> / tmp / svnbackup.dump

RESTORING BACKUP


After creating a backup to restore, just run the following command:

sudo svnadmin load / var / lib / svn </ tmp / svnbackup.dump
For example, to automate this task attached a small script that can be put in the cron server for convenience when backing up versions of our system:

---- svnbackup.sh ----
#!/bin/sh HORA=$(date +"%Y-%m-%d")
FICHERO="/tmp/svnbackup-$HORA.dump"
REPOSITORIO= /var/lib/svn
svnadmin dump $REPOSITORIO > $FICHERO
---- fin svnbackup.sh ----

MySQL Backup on Linux


BACKUP DATABASE

Mysqldump command examples:

To perform the online backup of the database to the file mydb copia_seguridad.sql

mysqldump --opt mydb > backupfile.sql

Another more complex example of mysqldump to backup a database is as follows:
mysqldump --opt -password=mypassword -user=miuser mydatabase > backupfile.sql

In the latter case we are indicating a user name and password to access the database on which the backup is being done: mydatabase. SQL statements to rebuild that database file will be flushed archivo.sql.

RESTORE DATABASE

If we want to retrieve information from a file to restore a backup of the database will do with the mysql command. We will use a syntax like:

mysql mydb
This example is based restore mydb data stored in the backup file archivo.sql.

Another example of more complex command to restore a database is as follows:


mysql -password=mypassword -user=miuser mydb < backupfile.sql

Hope help!