Created
November 23, 2011 19:34
-
-
Save rponte/1389656 to your computer and use it in GitHub Desktop.
setting password to run pg_restore and pg_dump with ant script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<exec failifexecutionfails="true" failonerror="true" | |
executable="${postgres.dir}/bin/pg_dump" | |
output="backup-ouput.txt"> | |
<env key="PGPASSWORD" value="${postgres.password}" /> | |
<arg value="-U" /> | |
<arg value="${postgres.user}" /> | |
<arg value="-h" /> | |
<arg value="${postgres.host}" /> | |
<arg value="-Fc" /> | |
<arg value="--blobs" /> | |
<arg value="-f" /> | |
<arg value="${backup.db.file.path}" /> | |
<arg value="mydb" /> | |
</exec> | |
<available property="backup.file.present" file="${backup.db.file.path}" | |
type="file" description="Verificando se arquivo de backup do banco de dados foi criado corretamente." /> | |
<fail unless="backup.file.present" | |
message="Erro ao tentar efetuar backup do banco de dados." /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<exec failifexecutionfails="true" failonerror="true" | |
executable="${postgres.dir}/bin/pg_restore" | |
output="restore-output.txt"> | |
<env key="PGPASSWORD" value="${postgres.password}" /> | |
<arg value="-U" /> | |
<arg value="${postgres.user}" /> | |
<arg value="-h" /> | |
<arg value="${postgres.host}" /> | |
<arg value="--dbname" /> | |
<arg value="mydb" /> | |
<arg value="--verbose" /> | |
<arg value="${backup.db.file.path}" /> | |
</exec> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
:*