Odoo Database Auto Backup

Odoo Database Auto Backup

Imagine the magnitude of lost revenue if the production database of a large company became unavailable, even for just 5 or 10 minutes; or, if you lose database due to media failure and cannot restore or recover them because you do not have a backup. From your enterprise’s perspective, the results may be quite harsh. The key to your success in this situation is a well-defined backup and recovery strategy.

In large Enterprise, it is must to tailor your backup strategy. Backup strategy can be Hourly, Daily, Weekly, or Monthly depending on your enterprise.

Here we are sharing Odoo database auto backup using default Linux crontab very effectively without consuming much space for the database backup.

Create PostgreSQL Backup Script for Odoo

create a script called odoo_backup.sh on /var/scripts/ path. you can create the file using a nano text editor on the terminal. Here is the command.

Then copy and paste below code

Remove Old Odoo Database backup

Remove old database backup files which is older than 30 days.

create a file named clean_backup.sh on /var/scripts/ path. Here is the command.

Then copy and paste below code

After creating both the file we are ready to create cron(schedule) jobs using crontab. In below example backup runs daily at 2am and the old database cleanup job runs daily at 5am.

To edit or create your crontab file, type the following command at the Linux shell prompt:

Select default editor if you are using command first time. and paste the below line. for more information on Linux crontab, you can visit this website.

Now the crontab will take the backup of your odoo database using the odoo_backup.sh script everyday 2am in the morning and store the odoo database backup under /var/pgdump/.

It will work for all odoo database version.

Reference Links: https://www.odoo.com/forum/help-1/question/how-to-setup-a-regular-postgresql-database-backup-4728

Leave a Reply


Leading Enterprise Solutions Provider

Head Office

SF-02, 7 Sky Plaza,
Near Vuda Cross Road,
Gotri Vadodara,
Gujarat, India, 390021

Rajkot Branch

213, The Spire,
Near Ayodhya Chowk,
150 ft. Ring Road,
Rajkot, Gujarat, India, 360007

Email : hello@heliconia.io