sudo -u postgres psql -U postgres -l
sudo -u postgres /usr/bin/psql -U postgres
drop database databasename;
create database databasename;
sudo -u postgres /usr/bin/pg_dump -U postgres $basename | pigz > ~/$basename.sql.gz
sudo -u postgres /usr/bin/vacuumdb --full --analyze --username postgres --dbname $basename
sudo -u postgres /usr/bin/reindexdb --username postgres --dbname $basename
unpigz $basename.sql.gz
sudo -u postgres /usr/bin/psql -U postgres $basename < /home/postgres/$basename.sql