Backup Redmine

walden systems, geeks corner, programming, languages, developer, redmine, backup, shell, unix, bash, ksh
Shells read input up to an unquoted newline and then execute it. An unquoted backslash followed by a newline are discarded and cause the shell to wait for more input. The backslash and newline are discarded before the shell tokenizes the string, so long lines can be split anywhere outside of single quotes, even in the middle of command names and variable names.

Sometimes you might need to backup Redmine. There are many ways to accomplish this task and I would like to discuss one of the ways we are using here at Walden Systems, because we believe this is the most straightforward method to backup Redmine.

Strategy to backup Redmine is fairly simple: First, we need to backup the mysql database . Second, we need to backup the attached files.

Here are actual code samples:
The first thing you need to do is backup the database. We will be using mysqldump to do this. We will pipe the output of mysqldump to gzip which will then redirect to a file:


   /usr/bin/mysqldump -u  DATABASE_NAME | gzip > /PATH/TO/BACKUP/BACKUP.gz



Then you need to backup the attached files using rsync: 


    rsync -a /PATH/TO/ATTACHED/FILES /PATH/TO/BACKUP_DIR



 


So, this is how a final code for backing up Redmine will look like:

    /usr/bin/mysqldump -u  DATABASE_NAME | gzip > /PATH/TO/BACKUP/BACKUP.gz
    rsync -a /PATH/TO/ATTACHED/FILES /PATH/TO/BACKUP_DIR