http://www.postgresql.org/docs/9.1/interactive/backup-file.html
sudo service apache2 stop
sudo service postgresql stop
#%y%m%d_%H-%M
sudo tar -cvpjf /a/path/postgres-`date +%y%m%d`.tar.bz2 -C /var/lib/postgresql/9.1/main .
# Prevent parent directories from being tarred
# -C, --directory DIR
# change to directory DIR
# -p, --preserve-permissions, --same-permissions
# extract information about file permissions (default for superuser)
sudo service postgresql start
sudo service apache2 start
# when extract
#sudo tar -xvjf postgres-xxxxxx.tar.bz2
No comments:
Post a Comment