Last active
December 8, 2016 05:44
-
-
Save sungmin-park/83ba6fe53c7621cad1bdf34459d98b46 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/sh | |
if [ -z "$1" ] | |
then | |
echo "usage> $0 DATABASE" >&2 | |
exit 1 | |
fi | |
# Cannot use pipe. Pipe produces an empty backup file when pg_dump has errors. | |
FILE_NAME="$1-`date +"%Y%m%d-%H%M%S"`.sql" | |
pg_dump --no-owner --no-acl --file="$FILE_NAME" $1 && gzip "$FILE_NAME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment