#!/bin/bash
###creator:huangxifeng
###createtime:2009-10-23
###describe:hot backup postgresql database
y=`date --date="1 days ago" +%Y`;
m=`date --date="1 days ago" +%m`;
d=`date --date="1 days ago" +%d`;
label=\'$y$m$d\'; #备份标签
/opt/pgsql/bin/psql -c "select pg_start_backup($label);"; #启动备份
cp -r /opt/pgsql/data /backup/databk; #开始备份
/opt/pgsql/bin/psql -c "select pg_stop_backup();"; #结束备份
if [ $? ]
then
echo "[hxf] [`date`] hot backup database successfully!"; #备份成功
fi
阅读(2326) | 评论(0) | 转发(0) |