码迷,mamicode.com
首页 > 数据库 > 详细

Odoo Auto Backup Database And Set Linux task schedualer

时间:2014-12-22 10:41:13      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:

First ,Write Database Backup Script:

pg_dump -Fc yourdatabasename > /home/yourfilepath/yourdatabasename$(data+%Y-%m-%d).dump

Save it as a file name dump.sh

 

su root user,and set schedualer job:

crontab -e

set every day 3:00 am auto backup database:

00 3 * * * su - postgres /home/dump.sh >> /var/log/cron.pgsql.log 2>&1

if needed, set auto delete database file 10days before:

00 5 * * * find /home/db_backup -name *.dump -mtime +10 -exec rm "{}" \;

 

at last,restart cron service:

sudo service cron restart

 

Odoo Auto Backup Database And Set Linux task schedualer

标签:

原文地址:http://www.cnblogs.com/kfx2007/p/4177479.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!