Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
6499 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor

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

Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
bře 15
10719
1
bře 24
1681
2
led 24
1779
5
srp 24
14923
1
bře 15
3790