Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
7278 Visualizzazioni

Hello guy!

All by backup system is great here. But it miss one thing... How could I erase my oldest databases with my script? Which system do you use?

For the moment, I can delete database easily with (example) :

/usr/bin/dropdb  -U "odoo" odoo_quotidien_01-12-2014_17:00:01 2>>/home/flooder/Programmes/log/clean-databases-pt.log

All my databases names are in the form (with the date in):       

odoo_quotidien_01-12-2014_17:00:01

odoo_quotidien_02-12-2014_17:00:01

...

Thanks for youtr tips!

Avatar
Abbandona
Risposta migliore

You should script a bash script for this. I assume you always place the dumps in the same folder. Create a bash script that automaticly checks all files in the directory and let it remove the oldest (or for example dumps older than xx days)

A great example: https://wiki.postgresql.org/wiki/Automated_Backup_on_Linux 
Also have a look at this script: https://www.odoo.com/nl_NL/forum/help-1/question/how-do-i-automate-database-backups-8899
You can customize this as you wish. On a specific date, looping over them, creating a new one every xx time etc.

Update: If you also want to drop the db's / schema's from your postgreSQL you should look at the dropdb and drop schema commands. For example: http://www.postgresql.org/docs/9.4/static/sql-dropschema.html

Update #2

I've created a module which automatically does all this and is integrated in Odoo (V8).Have a look at my guide/topic about it here.

Avatar
Abbandona
Autore

For the dump files, i'm ok. I can clean the oldest files. Now I want to delete ALSO the DATABASES. When I export to dump file, I also create a new database with it automatically. Now I have 200 databases and I want to clean it. Thanks

You should then look at the dropdb and drop schema command (http://www.postgresql.org/docs/9.4/static/sql-dropschema.html for example)

Nice solution

Risposta migliore

My suggestion, if your system Debian or Ubuntu, install module autopostgresqlbackup:

sudo apt-get update
sudo apt-get install autopostgresqlbackup

This is the best tools for me. This create, auto and hot: latest, daily, weekly and monthly backup with rotation, triggered by cron.

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
mar 15
12111
1
mar 24
2324
2
gen 24
2445
5
ago 24
15589
1
mar 15
4419