如何定期备份Odoo(OpenERP)数据库


如何定期备份Odoo(OpenERP)数据库

www.chinamaker.net 2013-09-05 11:56:00 admin

 

I use the following setup:
 
Backup-Script /var/script/dump_db.sh
 
#!/bin/sh    
hostname=`hostname`
 
##########################################
## OpenERP Backup
## Backup databases: openerpdb1, openerpdb2
##########################################
 
# Stop OpenERP Server
/etc/init.d/openerp-server stop
 
# Dump DBs
for db in openerpdb1 openerpdb2
do
  date=`date +"%Y%m%d_%H%M%N"`
  filename="/var/pgdump/${hostname}_${db}_${date}.sql"
  pg_dump -E UTF-8 -p 5433 -F p -b -f $filename $db
  gzip $filename
done
 
# Start OpenERP Server
/etc/init.d/openerp-server start
 
exit 0
 
Housekeeping script /var/script/housekeeping.sh (deletes backups which are older than 30 days)
 
#!/bin/sh
path=/var/pgdump
logfile=/var/log/$0
 
rm -f $logfile
for file in `find /var/pgdump/ -mtime +30 -type f -name *.sql.gz`
do
  echo "deleting: " $file >> $logfile
  rm $file
done
 
exit 0
 
Create daily cronjobs in /etc/crontab. The backup runs daily at 1am and the housekeeping job runs daily at 5am.
 
# m h dom mon dow user  command
0 1 * * * postgres /var/scripts/dump_db.sh
0 5 * * * postgres /var/scripts/housekeeping.sh

来源:苏州远鼎官网


相关标签 TAG :  odoo  数据库  定期  备份    


苏州远鼎

运用前沿科学技术,苏州远鼎信息技术有限公司以开源管理软件产品为核心,为企业和政府组织提供软件及服务,是OpenERP(Odoo)专业服务商,中国开源管理软件服务市场的领跑者。

Read More

远鼎产品

联系远鼎

  • 苏州工业园区星湖街328号22栋301
  • +86-0512-69361217
  • odoo@chinamaker.net
  • www.chinamaker.net