Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
6498 มุมมอง

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!

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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.

อวตาร
ละทิ้ง
ผู้เขียน

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

คำตอบที่ดีที่สุด

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.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 15
10715
1
มี.ค. 24
1679
2
ม.ค. 24
1777
5
ส.ค. 24
14922
1
มี.ค. 15
3790