These scripts provide a simple way to backup and restore Odoo databases and their associated filestores.
backup.sh
: Creates a compressed backup of the Odoo database and filestore.restore.sh
: Restores an Odoo database and filestore from the created backup.
- PostgreSQL client (
pg_dump
,createdb
,dropdb
) must be installed and accessible in the path. - The user must have permission to access and create/delete the database in PostgreSQL.
- The scripts assume that Odoo filestore is present at
/var/lib/odoo/filestore/
.
Before using the scripts, ensure that the following environment variables are set:
HOST
: The hostname of the PostgreSQL server.USER
: The username used for PostgreSQL connections.PASSWORD
: The password used for PostgreSQL connections.
These variables can be set in the environment or directly in the scripts.
To create a backup of your Odoo database and filestore, use the backup_odoo.sh
script as follows:
./backup.sh <database_name>
Replace <database_name>
with the name of your Odoo database.
The script will create a timestamped backup file in the defined BACKUP_DIR
.
To restore an Odoo database and filestore from a backup, use the restore_odoo.sh
script as follows:
./restore.sh <database_name>
Replace <database_name>
with the name of the Odoo database to restore.
The script will look for the most recent backup in the defined BACKUP_DIR
and restore it.
These scripts are provided "as is", without warranty of any kind. The user assumes all risks associated with the use of these scripts. Always test scripts in a non-production environment before use.