We already saw in this post, how to make a full backup of Redmine on a Linux server.
In this article I will explain you how to do the same on a Redmine installed on a Windows server using the Bitnami installer.
Prepare the directories where the backup will be stored
We are going to create two folders where we will store the copies that the system will make. The directories will be outside the Bitnami Redmine installation folder. As an example we are going to create these folders on the server desktop:

We have created a main folder called “Backup” and two subfolders called “Database” and “Files”.
Keep in mind that to make a complete backup of Redmine we have to perform, separately, two actions: a backup of the database and a copy of the Redmine /files folder to another directory on the server. You might also prefer to make a copy of the entire Redmine directory (including plugins, themes, etc.). Then the folder to copy to would be the base installation folder: in my case, C:/Bitnami/redmine-5.0.0-0-0.
Check the database credentials
We will need to copy the database credentials to be able to launch the copy. Go to the installation folder that Bitnami created when Redmine was installed and locate the database.yml file. In my case the path to the file is this: C:/Bitnami/redmine-5.0.0-0/apps/redmine/htdocs/config/database.yml
- the database name (database)
- the database name (username)
- the password (password)
We also assume that the database server is localhost and the port is the standard 3306.
Create the backup script
We are going to create a script that will tell the system all the actions it has to do to perform the backup.
Backup script
#!/bin/bash
#create the script variables --database
DATE=$(date +"%Y-%m-%d-%H%M")
SQLFILE="${DATE}-redmine-databasedump.sql"
#you will have to change the following data for the ones you have obtained in the previous step
DATABASE="bitnami_redmine"
USER="bitnami"
PASSWORD="08c6355aea"
# Backup of the database and subsequent compression and saving in the folder Backup/Database
mysqldump -u "${USER}" -p"${PASSWORD}" "${DATABASE}" | gzip > "C:/Users/Administrator/Desktop/Backup/Database/${SQLFILE}.gz"
# create the script variables --files
FILES_DATE=$(date +"%Y-%m-%d-%H%M")
FILES_DIR="C:/Bitnami/redmine-5.0.0-0/apps/redmine/htdocs/files"
FILES_ARCHIVE="C:/Users/Administrator/Desktop/Backup/Files/${FILES_DATE}-redmine-filesdump.zip"
# Copying and zipping the folder (we use 7z but you could also use Zip)
cd "$FILES_DIR" && 7z a -r "$FILES_ARCHIVE" ./*
# Delete the folder that was copied to Backup/Files (we only want the zip file)
rm -r "C:/Users/Administrator/Desktop/Backup/Files/${FILES_DATE}-redmine-filesdump"
We will name the scrip file: backup.bat and you can save it in the Redmine root folder, as I have done, although it could perfectly well go to a folder external to Redmine, so that it is not lost in case we upgrade Redmine to another version.
Explanation of the script
In the first lines of the script we are declaring the variables that we will use in the script. Of course, you will have to replace the database name, username and password with the ones you have found in your database.yml file.
This is what the script will do when you launch it:
- It makes a copy of the database
- It compresses it into a .gz file.
- Saves the file to the /backups/database directory
- Makes a copy of the redmine /files directory to the /backups/files folder
- Compresses it into a .zip file
- Deletes the copied folder
To launch the script manually, you have to follow the steps below:



- Go to the Bitnami Redmine installation folder, in my case C:/Bitnami/redmine-5.0.0-0-0
- Double click on the file “use_redmine”. This will open the Bitnami console and place you in the same directory.
- Launch the following command:
sh backup.bat
Press Enter and when the system has finished (depending on the size of the database and the file directory, it can be a few seconds or several minutes) the script should have created two files like these:
2023-02-24-1132-redmine-databasedump.sql.gz
2023-02-24-1134-redmine-filesdump.zip
Now go to the backups folder and check that they have been created.
Backup Redmine on Windows on a scheduled and unattended basis
Ok, Luis, this is all very well, but I can't be every day launching manually the backup command… No problem! Although in Windows we don't have cron jobs for this kind of scheduled tasks, we do have the “Task scheduler”, which allows us to do almost the same thing.
Launch script
Before we start with the scheduled task, we have to create a first script to tell Windows to use the Redmine console, not its own console, because in this case, the backup would not be generated. This will be the script that will invoke the initially scheduled task:
#change the path to your own
call C:\Bitnami\redmine-5.0.0-0\use_redmine.bat
bash backup.bat
As you can see, this is invoking the Redmine console and then launching the backup script from that console. In my case, I saved the script in the Redmine root folder.
Scheduled task for Redmine backup on Windows
Let's say we want the full backup to be done daily at 5am. Well, let's create a scheduled task that every day at 5am launches the command that invokes the script we created. Here are the steps:
- Open the Windows Task Scheduler by looking for “Task Scheduler” in the Start menu.
- Click “Create Task” in the right pane.
- On the General tab, enter a name for the task (for example, “Redmine Backup”).
- Configure the task to run whether the user is logged in or not, and to run with the highest privileges.
- On the Triggers tab, click “New” and set the trigger to run daily at 5:00 am.
- On the Actions tab, click “New” and configure the action to start a program, then enter the path to the script file.
- On the Settings tab, configure any additional settings as needed.
- Click “OK” to save the scheduled task.
- Click “Enable”.
The backup will now take place every day at 5am.
To make it clearer, here are some screenshots of how to set up the scheduled task:



General






In principle, no further configuration should be necessary, although you can check the other tabs.
Once you have created the scheduled task, it is important to remember that you have to “enable” it, otherwise the backup command will not be launched. Try also to launch the scheduled task by clicking on “Run”:



Retention policy
If we don't include some method of deleting old backups, we may find that the server runs out of space at some point.
To prevent this from happening, we can add a couple of lines to the original script so that the old files are automatically deleted. In this example we will leave only the last 3 files in each folder. All other files in the backup will be destroyed automatically. Check the new script:
#!/bin/bash
#create the script variables --database
DATE=$(date +"%Y-%m-%d-%H%M")
SQLFILE="${DATE}-redmine-databasedump.sql"
#you will have to change the following data for the ones you have obtained in the previous step
DATABASE="bitnami_redmine"
USER="bitnami"
PASSWORD="08c6355aea"
# Backup of the database and subsequent compression and saving in the folder Backup/Database
mysqldump -u "${USER}" -p"${PASSWORD}" "${DATABASE}" | gzip > "C:/Users/Administrator/Desktop/Backup/Database/${SQLFILE}.gz"
# create the script variables --files
FILES_DATE=$(date +"%Y-%m-%d-%H%M")
FILES_DIR="C:/Bitnami/redmine-5.0.0-0/apps/redmine/htdocs/files"
FILES_ARCHIVE="C:/Users/Administrator/Desktop/Backup/Files/${FILES_DATE}-redmine-filesdump.zip"
# Copying and zipping the folder (we use 7z but you could also use Zip)
cd "$FILES_DIR" && 7z a -r "$FILES_ARCHIVE" ./*
# Delete the folder that was copied to Backup/Files (we only want the zip file)
rm -r "C:/Users/Administrator/Desktop/Backup/Files/${FILES_DATE}-redmine-filesdump"
# Delete the old backups (we keep the last 3)
ls -t "C:/Users/Administrator/Desktop/Backup/Files"/* | awk 'NR>3' | xargs rm --
ls -t "C:/Users/Administrator/Desktop/Backup/Database"/*.gz | awk 'NR>3' | xargs rm --
So finally we have a system that:
- backs up the database and files every day at 5am, storing a compressed version of them in the backup directory
- deletes the old backup files so that only the last 3 files remain in each directory.
I hope you found this tip useful! Please, share the post through your social networks if you liked it 🙂