标签:数据库 postgresql
[root@newfs tmp]# vi 2.sh
#!/bin/bash
BACKUP="/home/bak"
#RSYCN="/usr/bin/rsync"
#OPTIONS="-rlHpogDtS --delete"
DATE=`date +%Y%m%d`
LOG_FILE="/var/log/backup/backupdb_$DATE.log"
SERVER="192.168.2.31"
#1.postgresql
PG_DUMP="/usr/bin/pg_dump"
echo "$PG_DUMP -U postgres -h $SERVER mi | gzip > $BACKUP/db/sql_mi_$DATE.gz" >> $LOG_FILE
$PG_DUMP -U postgres -h $SERVER mi | gzip > $BACKUP/db/sql_mi_$DATE.gz
[root@newfs tmp]# ./2.sh
[root@newfs db]# ll
total 104
-rw-r--r-- 1 root root 103126 Aug 22 17:00 sql_mi_20140822.gz
标签:数据库 postgresql
原文地址:http://fslc2004.blog.51cto.com/1559375/1543598