[root@test02 ~]# more /www/hotbackup.sh
#!/bin/bash
owen_user=postgres
DATE=`date +%Y%m%d`
pgdata=/usr/local/pgsql/data
hotbackup=/backup/$DATE
wals=/backup/wals
mkdir /backup/$DATE
echo -e "`date +%F%T` ----------- start backup datafile complete! \n "
psql -c "select pg_start_backup( 'full backup - sanday' );"
tar -zcvf $hotbackup/fullbackup$DATE.tar.gz $pgdata --exclude $pgdata/pg_xlog
tar -zcvf $hotbackup/wals$DATE.tar.gz $wals
rm -rf $wals/*
psql -c "select pg_stop_backup();"
echo -e "`date +%F%T` ----------- stop backup datafile complete! \n "
[root@test02 ~]#
阅读(2529) | 评论(0) | 转发(0) |